Velocity Closed Loop Dynamic error correction

Dependencies:   mbed QEI PID DmTftLibraryEx

Revision:
17:a0bbfc228415
Parent:
15:ed7ed20b7114
--- a/Display/Menu.cpp	Tue Aug 22 13:26:29 2017 +0000
+++ b/Display/Menu.cpp	Wed Jul 18 08:51:53 2018 +0000
@@ -401,6 +401,7 @@
                     if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
                     {
                         Eeprom.EepromData.DemoSettings.HoldDemo = false;
+                        ButtonChangeText( BTN8_BORDER, ( uint8_t* )"    STOP", NULL );
                         Eeprom.EepromData.DemoSettings.CntPacketTx          = 0;
                         Eeprom.EepromData.DemoSettings.CntPacketRxOK        = 0;
                         Eeprom.EepromData.DemoSettings.CntPacketRxOKSlave   = 0;
@@ -409,18 +410,19 @@
                         Eeprom.EepromData.DemoSettings.RxTimeOutCount       = 0;
                         StopDemoApplication( );
                         RunDemoApplicationPingPong( );
-                        ButtonChangeText( BTN8_BORDER, ( uint8_t* )"    STOP", NULL );
                     }
                     else
                     {
                         Eeprom.EepromData.DemoSettings.HoldDemo = true;
+                        ButtonChangeText( BTN8_BORDER, ( uint8_t* )"   START", NULL );
                         StopDemoApplication( );
-                        ButtonChangeText( BTN8_BORDER, ( uint8_t* )"   START", NULL );
+                        wait_ms( 200 ); // debouncing of the touch screen
                     }
                 }
                 else if( graphObjectTouched == BTN9_BORDER )
                 {
                     Eeprom.EepromData.DemoSettings.HoldDemo = true;
+                    StopDemoApplication( );
                     // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
                     // PreviousPage to set next page. Speed up the navigation.
                     PreviousPage = PAGE_PING_PONG;
@@ -471,24 +473,26 @@
                     if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
                     {
                         Eeprom.EepromData.DemoSettings.HoldDemo = false;
+                        ButtonChangeText( BTN8_BORDER, ( uint8_t* )"    STOP", NULL );
                         StopDemoApplication( );
                         Eeprom.EepromData.DemoSettings.CntPacketTx          = 0;
                         Eeprom.EepromData.DemoSettings.CntPacketRxOK        = 0;
                         Eeprom.EepromData.DemoSettings.CntPacketRxKO        = 0;
                         Eeprom.EepromData.DemoSettings.RxTimeOutCount       = 0;
                         RunDemoApplicationPer( );
-                        ButtonChangeText( BTN8_BORDER, ( uint8_t* )"    STOP", NULL );
                     }
                     else
                     {
                         Eeprom.EepromData.DemoSettings.HoldDemo = true;
+                        ButtonChangeText( BTN8_BORDER, ( uint8_t* )"   START", NULL );
                         StopDemoApplication( );
-                        ButtonChangeText( BTN8_BORDER, ( uint8_t* )"   START", NULL );
+                        wait_ms( 200 ); // debouncing of the touch screen
                     }
                 }
                 else if( graphObjectTouched == BTN9_BORDER )
                 {
                     Eeprom.EepromData.DemoSettings.HoldDemo = true;
+                    StopDemoApplication( );
                     // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
                     // PreviousPage to set next page. Speed up the navigation.
                     PreviousPage = PAGE_PER;
@@ -1427,7 +1431,7 @@
             DrawText( TITLE_TEXT, ( uint8_t* )"      SX1280 Demo Kit", NULL, NULL );
             DisplayDriverDrawLogo( SemtechLogo, 20, 37 );
             DrawActiveButton( BTN2_BORDER, ( uint8_t* )"DEMO Ping Pong", NULL );
-            DrawActiveButton( BTN3_BORDER, ( uint8_t* )"DEMO PER", NULL );
+            DrawActiveButton( BTN3_BORDER, ( uint8_t* )"DEMO PER FHSS", NULL );
             DrawActiveButton( BTN4_BORDER, ( uint8_t* )"Outdoor ranging demo", NULL );
             DrawActiveButton( BTN5_BORDER, ( uint8_t* )"Radio Test Modes", NULL );
             DrawActiveButton( BTN6_BORDER, ( uint8_t* )"Radio Settings", NULL );
@@ -1516,7 +1520,7 @@
             }
             else
             {
-                DrawText( TITLE_TEXT, ( uint8_t* )"         PER Demo", NULL, NULL );
+                DrawText( TITLE_TEXT, ( uint8_t* )"     PER Demo FHSS", NULL, NULL );
                 DrawText( LINE3_COL0_TEXT, ( uint8_t* )"Test Total", ( uint8_t* )GetMenuDemoMaxNumPacket( ), NULL );
                 DisplayCurrentRadioParams( PAGE_PER );
                 if( Eeprom.EepromData.DemoSettings.Entity == MASTER )
@@ -2157,6 +2161,12 @@
     return StringText2;
 }
 
+void UpdateRadioFrequency( unsigned long freq )
+{
+    sprintf( StringText ,"f:%1d.%03d GHz, P:%s, %s", freq / 1000000000, ( freq / 1000000 ) % 1000, GetRadioTxPower( ), GetAntennaSetting( ) );
+    DrawText( LINE0_TEXT, ( uint8_t* )StringText, NULL, NULL );
+}
+
 char* GetRadioFrequencyGHz( void )
 {
     // quicker than using a float (which is not optimized in MBED)