Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed QEI PID DmTftLibraryEx
Revision 13:94a3f92fd49c, committed 2017-05-30
- Comitter:
- GregCr
- Date:
- Tue May 30 12:02:47 2017 +0000
- Parent:
- 12:126f65d424b6
- Child:
- 14:ebd89dacc807
- Commit message:
- - corrected ranging measurement algo above 50m; - changed version number
Changed in this revision
| Demo/DemoApplication.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Demo/DemoApplication.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Demo/DemoApplication.cpp Tue May 30 09:28:52 2017 +0000
+++ b/Demo/DemoApplication.cpp Tue May 30 12:02:47 2017 +0000
@@ -1845,7 +1845,7 @@
uint8_t CheckDistance( void )
{
- double mean = 0.0;
+ double displayRange = 0.0;
double rssi = Eeprom.EepromData.DemoSettings.RssiValue;
uint16_t j = 0;
@@ -1881,8 +1881,16 @@
median = RawRngResults[RngResultIndex/2];
}
- mean = t0 + t1 * rssi + t2 * pow(rssi,2) + t3 * pow(rssi, 3) +t4 * median + t5 * pow(median,2) + t6 * pow(median, 3) + t7 * pow(median, 4) ;
-
+ if( median < 50 )
+ {
+ // Apply the short range correction and RSSI short range improvement below 50 m
+ displayRange = t0 + t1 * rssi + t2 * pow(rssi,2) + t3 * pow(rssi, 3) +t4 * median + t5 * pow(median,2) + t6 * pow(median, 3) + t7 * pow(median, 4) ;
+ }
+ else
+ {
+ displayRange = median;
+ }
+
if( j < DEMO_RNG_CHANNELS_COUNT_MIN )
{
Eeprom.EepromData.DemoSettings.RngStatus = RNG_PER_ERROR;
@@ -1892,7 +1900,7 @@
Eeprom.EepromData.DemoSettings.RngStatus = RNG_VALID;
}
- if( mean < 0 )
+ if( displayRange < 0 )
{
Eeprom.EepromData.DemoSettings.RngDistance = 0.0;
}
@@ -1901,20 +1909,20 @@
switch( Eeprom.EepromData.DemoSettings.RngUnit )
{
case DEMO_RNG_UNIT_SEL_M:
- Eeprom.EepromData.DemoSettings.RngDistance = mean;
+ Eeprom.EepromData.DemoSettings.RngDistance = displayRange;
break;
case DEMO_RNG_UNIT_SEL_YD:
- Eeprom.EepromData.DemoSettings.RngDistance = mean * DEMO_RNG_UNIT_CONV_YD;
+ Eeprom.EepromData.DemoSettings.RngDistance = displayRange * DEMO_RNG_UNIT_CONV_YD;
break;
case DEMO_RNG_UNIT_SEL_MI:
- Eeprom.EepromData.DemoSettings.RngDistance = mean * DEMO_RNG_UNIT_CONV_MI;
+ Eeprom.EepromData.DemoSettings.RngDistance = displayRange * DEMO_RNG_UNIT_CONV_MI;
break;
}
}
}
- printf( ", Rssi: %d, Zn: %3d, Zmoy: %5.1f, FEI: %d\r\n", Eeprom.EepromData.DemoSettings.RssiValue, j, mean, ( int32_t )Eeprom.EepromData.DemoSettings.RngFei );
+ printf( ", Rssi: %d, Zn: %3d, Zmoy: %5.1f, FEI: %d\r\n", Eeprom.EepromData.DemoSettings.RssiValue, j, displayRange, ( int32_t )Eeprom.EepromData.DemoSettings.RngFei );
return j;
}
--- a/Demo/DemoApplication.h Tue May 30 09:28:52 2017 +0000 +++ b/Demo/DemoApplication.h Tue May 30 12:02:47 2017 +0000 @@ -19,7 +19,7 @@ /*! * \brief Used to display firmware version on TFT (Utilities menu) */ -#define FIRMWARE_VERSION ( ( char* )"Firmware Version: 170511" ) +#define FIRMWARE_VERSION ( ( char* )"Firmware Version: 170530" ) /*! * \brief Define range of central frequency [Hz]