Velocity Closed Loop Dynamic error correction

Dependencies:   mbed QEI PID DmTftLibraryEx

Committer:
lex9296
Date:
Thu Jan 20 08:15:44 2022 +0000
Revision:
21:ab8027016a2c
Parent:
20:626b92b70bf7
Child:
22:12c555cade79
Publish - 20 Gennaio 2022

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mverdy 20:626b92b70bf7 1 /*
mverdy 20:626b92b70bf7 2 ______ _
mverdy 20:626b92b70bf7 3 / _____) _ | |
mverdy 20:626b92b70bf7 4 ( (____ _____ ____ _| |_ _____ ____| |__
mverdy 20:626b92b70bf7 5 \____ \| ___ | (_ _) ___ |/ ___) _ \
mverdy 20:626b92b70bf7 6 _____) ) ____| | | || |_| ____( (___| | | |
mverdy 20:626b92b70bf7 7 (______/|_____)_|_|_| \__)_____)\____)_| |_|
mverdy 20:626b92b70bf7 8 (C)2016 Semtech
mverdy 20:626b92b70bf7 9
mverdy 20:626b92b70bf7 10 Description: Display demo menus and manage touch sensor.
mverdy 20:626b92b70bf7 11
mverdy 20:626b92b70bf7 12 Maintainer: Gregory Cristian & Gilbert Menth
mverdy 20:626b92b70bf7 13 */
mverdy 20:626b92b70bf7 14
lex9296 21:ab8027016a2c 15 //#include "DmTftRa8875.h"
lex9296 21:ab8027016a2c 16 //#include "mbed.h"
lex9296 21:ab8027016a2c 17 //#include "Eeprom.h"
lex9296 21:ab8027016a2c 18 //#include "DisplayDriver.h"
lex9296 21:ab8027016a2c 19 #include "DmTftIli9341.h"
lex9296 21:ab8027016a2c 20 #include "DmTouch.h"
lex9296 21:ab8027016a2c 21 #include "DmTouchCalibration.h"
lex9296 21:ab8027016a2c 22
mverdy 20:626b92b70bf7 23 #include <stdio.h>
mverdy 20:626b92b70bf7 24 #include "mbed.h"
mverdy 20:626b92b70bf7 25 #include "Menu.h"
mverdy 20:626b92b70bf7 26 #include "DisplayDriver.h"
mverdy 20:626b92b70bf7 27 #include "Eeprom.h"
lex9296 21:ab8027016a2c 28 //#include "DemoApplication.h"
mverdy 20:626b92b70bf7 29 #include "main.h"
mverdy 20:626b92b70bf7 30 #include "app_config.h"
mverdy 20:626b92b70bf7 31
mverdy 20:626b92b70bf7 32 #if defined(HAS_GPS_SENSOR)
mverdy 20:626b92b70bf7 33 #include "GpsMax7.h"
mverdy 20:626b92b70bf7 34
mverdy 20:626b92b70bf7 35 /*!
mverdy 20:626b92b70bf7 36 * \brief Pointer to GPS Data, will be updated when Max7GpsgetData( ) is called.
mverdy 20:626b92b70bf7 37 */
mverdy 20:626b92b70bf7 38 GpsStruct *thisGps;
mverdy 20:626b92b70bf7 39 #endif
mverdy 20:626b92b70bf7 40
mverdy 20:626b92b70bf7 41 #if defined(HAS_PROXIMITY_SENSOR)
mverdy 20:626b92b70bf7 42 #include "SX9306.h"
mverdy 20:626b92b70bf7 43 #endif
mverdy 20:626b92b70bf7 44
mverdy 20:626b92b70bf7 45
mverdy 20:626b92b70bf7 46 /*!
mverdy 20:626b92b70bf7 47 * \brief Maximum character count on the same line with function DrawText
mverdy 20:626b92b70bf7 48 * This include needed space for the outline (at the begin and the end of line).
mverdy 20:626b92b70bf7 49 * MAX_CHAR_PER_BTN is the same, but for a button.
mverdy 20:626b92b70bf7 50 */
mverdy 20:626b92b70bf7 51 #define MAX_CHAR_PER_LINE 28
mverdy 20:626b92b70bf7 52
mverdy 20:626b92b70bf7 53 #define SCALE_LINE_COUNT 5
mverdy 20:626b92b70bf7 54 #define RANGING_FULLSCALE_MIN 10
mverdy 20:626b92b70bf7 55 #define RANGING_FULLSCALE_MAX 30000
mverdy 20:626b92b70bf7 56
lex9296 21:ab8027016a2c 57 // DmTftIli9341( PinName cs, PinName dc, PinName mosi, PinName miso, PinName clk )
lex9296 21:ab8027016a2c 58 // DM_TFT28_105
lex9296 21:ab8027016a2c 59 //DmTftIli9341 Tft( D10, D9, D11, D12, D13 );
lex9296 21:ab8027016a2c 60 //DmTouch Touch( DmTouch::DM_TFT28_105, D9, D11, D12 );
lex9296 21:ab8027016a2c 61 //DmTouchCalibration Calibration = DmTouchCalibration( &Tft, &Touch );
lex9296 21:ab8027016a2c 62
mverdy 20:626b92b70bf7 63 /*!
mverdy 20:626b92b70bf7 64 * \brief Bitmap of Semtech Logo stored here (copied from a C file).
mverdy 20:626b92b70bf7 65 */
mverdy 20:626b92b70bf7 66 extern uint8_t SemtechLogo[];
mverdy 20:626b92b70bf7 67
mverdy 20:626b92b70bf7 68
mverdy 20:626b92b70bf7 69 /*!
mverdy 20:626b92b70bf7 70 * \brief This ticker give the rythme to check X and Y coordinates of activated
mverdy 20:626b92b70bf7 71 * touched region (if pressed). CheckScreenFlag keep the status if Touchscreen
mverdy 20:626b92b70bf7 72 * has been checked or not, until checked.
mverdy 20:626b92b70bf7 73 */
mverdy 20:626b92b70bf7 74 Ticker CheckScreenTouch;
mverdy 20:626b92b70bf7 75 volatile bool CheckScreenFlag = false;
mverdy 20:626b92b70bf7 76
mverdy 20:626b92b70bf7 77 /*!
mverdy 20:626b92b70bf7 78 * \brief This ticker give the rythme to refresh a page when continuous info
mverdy 20:626b92b70bf7 79 * has to be printed in the same page.
mverdy 20:626b92b70bf7 80 */
mverdy 20:626b92b70bf7 81 Ticker CheckPageRefresh;
mverdy 20:626b92b70bf7 82 volatile bool PageRefresh = false;
mverdy 20:626b92b70bf7 83
mverdy 20:626b92b70bf7 84 /*!
mverdy 20:626b92b70bf7 85 * \brief This ticker give the rythme to avoid quick menu change
mverdy 20:626b92b70bf7 86 */
mverdy 20:626b92b70bf7 87 Ticker DebouncedScreenTouch;
mverdy 20:626b92b70bf7 88 volatile bool ScreenBeenDebounced = false;
mverdy 20:626b92b70bf7 89
mverdy 20:626b92b70bf7 90 /*!
mverdy 20:626b92b70bf7 91 * \brief List og graphical object in the application.
mverdy 20:626b92b70bf7 92 */
mverdy 20:626b92b70bf7 93 enum MenuObjectsId
mverdy 20:626b92b70bf7 94 {
mverdy 20:626b92b70bf7 95 PAGE_BORDER = 0,
mverdy 20:626b92b70bf7 96 TITLE_LINE,
mverdy 20:626b92b70bf7 97 TITLE_TEXT,
mverdy 20:626b92b70bf7 98 FIRM_LOGO,
mverdy 20:626b92b70bf7 99 BTN0_BORDER, // to accord with DrawActiveButton( ), each button should
mverdy 20:626b92b70bf7 100 BTN0_MENU_TEXT, // have consecutively MENU_TEXT (full large text),
mverdy 20:626b92b70bf7 101 BTN0_LABEL_TEXT, // LABEL_TEXT (left side of the button) and VALUE_TEXT
mverdy 20:626b92b70bf7 102 BTN0_VALUE_TEXT, // (right side of the button).
mverdy 20:626b92b70bf7 103 BTN1_BORDER,
mverdy 20:626b92b70bf7 104 BTN1_MENU_TEXT,
mverdy 20:626b92b70bf7 105 BTN1_LABEL_TEXT,
mverdy 20:626b92b70bf7 106 BTN1_VALUE_TEXT,
mverdy 20:626b92b70bf7 107 BTN2_BORDER,
mverdy 20:626b92b70bf7 108 BTN2_MENU_TEXT,
mverdy 20:626b92b70bf7 109 BTN2_LABEL_TEXT,
mverdy 20:626b92b70bf7 110 BTN2_VALUE_TEXT,
mverdy 20:626b92b70bf7 111 BTN3_BORDER,
mverdy 20:626b92b70bf7 112 BTN3_MENU_TEXT,
mverdy 20:626b92b70bf7 113 BTN3_LABEL_TEXT,
mverdy 20:626b92b70bf7 114 BTN3_VALUE_TEXT,
mverdy 20:626b92b70bf7 115 BTN4_BORDER,
mverdy 20:626b92b70bf7 116 BTN4_MENU_TEXT,
mverdy 20:626b92b70bf7 117 BTN4_LABEL_TEXT,
mverdy 20:626b92b70bf7 118 BTN4_VALUE_TEXT,
mverdy 20:626b92b70bf7 119 BTN5_BORDER,
mverdy 20:626b92b70bf7 120 BTN5_MENU_TEXT,
mverdy 20:626b92b70bf7 121 BTN5_LABEL_TEXT,
mverdy 20:626b92b70bf7 122 BTN5_VALUE_TEXT,
mverdy 20:626b92b70bf7 123 BTN6_BORDER,
mverdy 20:626b92b70bf7 124 BTN6_MENU_TEXT,
mverdy 20:626b92b70bf7 125 BTN6_LABEL_TEXT,
mverdy 20:626b92b70bf7 126 BTN6_VALUE_TEXT,
mverdy 20:626b92b70bf7 127 BTN7_BORDER,
mverdy 20:626b92b70bf7 128 BTN7_MENU_TEXT,
mverdy 20:626b92b70bf7 129 BTN8_BORDER,
mverdy 20:626b92b70bf7 130 BTN8_MENU_TEXT,
mverdy 20:626b92b70bf7 131 BTN9_BORDER,
mverdy 20:626b92b70bf7 132 BTN9_MENU_TEXT,
mverdy 20:626b92b70bf7 133 LINE0_TEXT,
mverdy 20:626b92b70bf7 134 LINE1_TEXT,
mverdy 20:626b92b70bf7 135 LINE2_TEXT,
mverdy 20:626b92b70bf7 136 LINE2_COL0_TEXT,
mverdy 20:626b92b70bf7 137 LINE2_COL1_TEXT,
mverdy 20:626b92b70bf7 138 LINE3_TEXT,
mverdy 20:626b92b70bf7 139 LINE3_COL0_TEXT,
mverdy 20:626b92b70bf7 140 LINE3_COL1_TEXT,
mverdy 20:626b92b70bf7 141 LINE3_COL2_TEXT,
mverdy 20:626b92b70bf7 142 LINE4_TEXT, // to accord with DrawText( ), each text line should
mverdy 20:626b92b70bf7 143 LINE4_COL0_TEXT, // have consecutively TEXT (full large text),
mverdy 20:626b92b70bf7 144 LINE4_COL1_TEXT, // COL0_TEXT (left side of the line), COL1_TEXT (center
mverdy 20:626b92b70bf7 145 LINE4_COL2_TEXT, // region of the line) and COL2_TEXT (right side of the
mverdy 20:626b92b70bf7 146 LINE5_COL0_TEXT, // line). COL0..2 are optionals if doesn't exist.
mverdy 20:626b92b70bf7 147 LINE5_COL1_TEXT,
mverdy 20:626b92b70bf7 148 LINE5_COL2_TEXT,
mverdy 20:626b92b70bf7 149 LINE6_COL0_TEXT,
mverdy 20:626b92b70bf7 150 LINE6_COL1_TEXT,
mverdy 20:626b92b70bf7 151 LINE6_COL2_TEXT,
mverdy 20:626b92b70bf7 152 LINE7_COL0_TEXT,
mverdy 20:626b92b70bf7 153 LINE7_COL1_TEXT,
mverdy 20:626b92b70bf7 154 LINE7_COL2_TEXT,
mverdy 20:626b92b70bf7 155 LINE8_COL0_TEXT,
mverdy 20:626b92b70bf7 156 LINE8_COL1_TEXT,
mverdy 20:626b92b70bf7 157 LINE9_COL0_TEXT,
mverdy 20:626b92b70bf7 158 LINE9_COL1_TEXT,
mverdy 20:626b92b70bf7 159 RNG_DIST_TEXT,
mverdy 20:626b92b70bf7 160 RNG_DIST_CIRCLE,
mverdy 20:626b92b70bf7 161 RNG_DS1_TEXT,
mverdy 20:626b92b70bf7 162 RNG_DS2_TEXT,
mverdy 20:626b92b70bf7 163 RNG_DS3_TEXT,
mverdy 20:626b92b70bf7 164 RNG_DS4_TEXT,
mverdy 20:626b92b70bf7 165 RNG_DS5_TEXT,
mverdy 20:626b92b70bf7 166 RNG_DS0_LINE,
mverdy 20:626b92b70bf7 167 RNG_DS1_LINE,
mverdy 20:626b92b70bf7 168 RNG_DS2_LINE,
mverdy 20:626b92b70bf7 169 RNG_DS3_LINE,
mverdy 20:626b92b70bf7 170 RNG_DS4_LINE,
mverdy 20:626b92b70bf7 171 RNG_DS5_LINE,
mverdy 20:626b92b70bf7 172 RNG_MST_SCR,
mverdy 20:626b92b70bf7 173 };
mverdy 20:626b92b70bf7 174 #define GRAPH_OBJECTS_COUNT 78
mverdy 20:626b92b70bf7 175 GraphObject_t MenuObjects[GRAPH_OBJECTS_COUNT] =
mverdy 20:626b92b70bf7 176 {
mverdy 20:626b92b70bf7 177 // { Id, Type, Xpos, Ypos, Height, Width, LineW, BackColor, FrontColor, DoFill, FillCol, Source, TouchActive }
mverdy 20:626b92b70bf7 178 { PAGE_BORDER, GO_RECTANGLE, 0, 0, 320, 240, 1, BACK_COLOR, PAGE_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 179 { TITLE_LINE, GO_LINE, 0, 30, 1, 240, 1, BACK_COLOR, PAGE_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 180 { TITLE_TEXT, GO_TEXT, 15, 9, NULL, 208, 1, BACK_COLOR, WHITE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 181 { FIRM_LOGO, GO_IMAGE, 20, 37, 95, 215, 1, BACK_COLOR, WHITE, false, NULL, SemtechLogo, false },
mverdy 20:626b92b70bf7 182 { BTN0_BORDER, GO_RECTANGLE, 10, 40, 30, 106, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 183 { BTN0_MENU_TEXT, GO_TEXT, 15, 48, NULL, 96, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 184 { BTN0_LABEL_TEXT, GO_TEXT, 15, 48, NULL, 32, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 185 { BTN0_VALUE_TEXT, GO_TEXT, 47, 48, NULL, 64, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 186 { BTN1_BORDER, GO_RECTANGLE, 10, 75, 30, 222, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 187 { BTN1_MENU_TEXT, GO_TEXT, 15, 83, NULL, 200, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 188 { BTN1_LABEL_TEXT, GO_TEXT, 15, 83, NULL, 64, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 189 { BTN1_VALUE_TEXT, GO_TEXT, 79, 83, NULL, 152, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 190 { BTN2_BORDER, GO_RECTANGLE, 10, 110, 30, 222, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 191 { BTN2_MENU_TEXT, GO_TEXT, 15, 118, NULL, 200, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 192 { BTN2_LABEL_TEXT, GO_TEXT, 15, 118, NULL, 64, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 193 { BTN2_VALUE_TEXT, GO_TEXT, 79, 118, NULL, 152, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 194 { BTN3_BORDER, GO_RECTANGLE, 10, 145, 30, 222, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 195 { BTN3_MENU_TEXT, GO_TEXT, 15, 153, NULL, 200, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 196 { BTN3_LABEL_TEXT, GO_TEXT, 15, 153, NULL, 64, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 197 { BTN3_VALUE_TEXT, GO_TEXT, 79, 153, NULL, 152, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 198 { BTN4_BORDER, GO_RECTANGLE, 10, 180, 30, 222, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 199 { BTN4_MENU_TEXT, GO_TEXT, 15, 188, NULL, 200, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 200 { BTN4_LABEL_TEXT, GO_TEXT, 15, 188, NULL, 64, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 201 { BTN4_VALUE_TEXT, GO_TEXT, 79, 188, NULL, 152, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 202 { BTN5_BORDER, GO_RECTANGLE, 10, 215, 30, 222, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 203 { BTN5_MENU_TEXT, GO_TEXT, 15, 223, NULL, 200, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 204 { BTN5_LABEL_TEXT, GO_TEXT, 15, 223, NULL, 64, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 205 { BTN5_VALUE_TEXT, GO_TEXT, 79, 223, NULL, 152, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 206 { BTN6_BORDER, GO_RECTANGLE, 10, 250, 30, 222, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 207 { BTN6_MENU_TEXT, GO_TEXT, 15, 258, NULL, 200, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 208 { BTN6_LABEL_TEXT, GO_TEXT, 15, 258, NULL, 64, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 209 { BTN6_VALUE_TEXT, GO_TEXT, 79, 258, NULL, 152, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 210 { BTN7_BORDER, GO_RECTANGLE, 10, 285, 30, 106, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 211 { BTN7_MENU_TEXT, GO_TEXT, 15, 293, NULL, 96, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 212 { BTN8_BORDER, GO_RECTANGLE, 125, 285, 30, 107, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 213 { BTN8_MENU_TEXT, GO_TEXT, 130, 293, NULL, 96, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 214 { BTN9_BORDER, GO_RECTANGLE, 125, 40, 30, 107, 1, BACK_COLOR, BUTTON_BORDER, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 215 { BTN9_MENU_TEXT, GO_TEXT, 130, 48, NULL, 96, 1, BACK_COLOR, MENU_TEXT, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 216 { LINE0_TEXT, GO_TEXT, 5, 80, NULL, 232, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 217 { LINE1_TEXT, GO_TEXT, 5, 100, NULL, 232, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 218 { LINE2_TEXT, GO_TEXT, 5, 120, NULL, 232, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 219 { LINE2_COL0_TEXT, GO_TEXT, 5, 120, NULL, 104, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 220 { LINE2_COL1_TEXT, GO_TEXT, 110, 120, NULL, 56, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 221 { LINE3_TEXT, GO_TEXT, 5, 140, NULL, 232, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 222 { LINE3_COL0_TEXT, GO_TEXT, 5, 140, NULL, 104, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 223 { LINE3_COL1_TEXT, GO_TEXT, 110, 140, NULL, 56, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 224 { LINE3_COL2_TEXT, GO_TEXT, 170, 140, NULL, 64, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 225 { LINE4_TEXT, GO_TEXT, 5, 160, NULL, 232, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 226 { LINE4_COL0_TEXT, GO_TEXT, 5, 160, NULL, 104, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 227 { LINE4_COL1_TEXT, GO_TEXT, 110, 160, NULL, 56, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 228 { LINE4_COL2_TEXT, GO_TEXT, 170, 160, NULL, 64, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 229 { LINE5_COL0_TEXT, GO_TEXT, 5, 180, NULL, 104, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 230 { LINE5_COL1_TEXT, GO_TEXT, 110, 180, NULL, 56, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 231 { LINE5_COL2_TEXT, GO_TEXT, 170, 180, NULL, 64, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 232 { LINE6_COL0_TEXT, GO_TEXT, 5, 200, NULL, 104, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 233 { LINE6_COL1_TEXT, GO_TEXT, 110, 200, NULL, 56, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 234 { LINE6_COL2_TEXT, GO_TEXT, 170, 200, NULL, 64, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 235 { LINE7_COL0_TEXT, GO_TEXT, 5, 220, NULL, 104, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 236 { LINE7_COL1_TEXT, GO_TEXT, 110, 220, NULL, 56, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 237 { LINE7_COL2_TEXT, GO_TEXT, 170, 220, NULL, 64, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 238 { LINE8_COL0_TEXT, GO_TEXT, 5, 240, NULL, 104, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 239 { LINE8_COL1_TEXT, GO_TEXT, 110, 240, NULL, 56, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 240 { LINE9_COL0_TEXT, GO_TEXT, 5, 260, NULL, 104, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 241 { LINE9_COL1_TEXT, GO_TEXT, 110, 260, NULL, 56, 1, BACK_COLOR, TEXT_VALUE, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 242 { RNG_DIST_TEXT, GO_TEXT, 63, 75, NULL, 120, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 243 { RNG_DIST_CIRCLE, GO_CIRCLE, 175, 270, 10, 10, 1, BACK_COLOR, GRAY1, true, GRAY1, NULL, false },
mverdy 20:626b92b70bf7 244 { RNG_DS1_TEXT, GO_TEXT, 188, 230, NULL, 40, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 245 { RNG_DS2_TEXT, GO_TEXT, 188, 198, NULL, 40, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 246 { RNG_DS3_TEXT, GO_TEXT, 188, 166, NULL, 40, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 247 { RNG_DS4_TEXT, GO_TEXT, 188, 134, NULL, 40, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 248 { RNG_DS5_TEXT, GO_TEXT, 188, 102, NULL, 40, 1, BACK_COLOR, TEXT_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 249 { RNG_DS0_LINE, GO_LINE, 185, 110, 160, 1, 1, BACK_COLOR, CIRCLE_FCOLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 250 { RNG_DS1_LINE, GO_LINE, 183, 238, 1, 5, 1, BACK_COLOR, CIRCLE_FCOLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 251 { RNG_DS2_LINE, GO_LINE, 183, 206, 1, 5, 1, BACK_COLOR, CIRCLE_FCOLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 252 { RNG_DS3_LINE, GO_LINE, 183, 174, 1, 5, 1, BACK_COLOR, CIRCLE_FCOLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 253 { RNG_DS4_LINE, GO_LINE, 183, 142, 1, 5, 1, BACK_COLOR, CIRCLE_FCOLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 254 { RNG_DS5_LINE, GO_LINE, 183, 110, 1, 5, 1, BACK_COLOR, CIRCLE_FCOLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 255 { RNG_MST_SCR, GO_RECTANGLE, 1, 70, 214, 238, 1, BACK_COLOR, BACK_COLOR, false, NULL, NULL, false },
mverdy 20:626b92b70bf7 256 };
mverdy 20:626b92b70bf7 257
mverdy 20:626b92b70bf7 258 /*!
mverdy 20:626b92b70bf7 259 * \brief DrawText( ) need char* to display a text. It can display until
mverdy 20:626b92b70bf7 260 * 3 different texts on the same line. To avoid recursive use of the same
mverdy 20:626b92b70bf7 261 * ressource, 3 temporary string are declared.
mverdy 20:626b92b70bf7 262 */
mverdy 20:626b92b70bf7 263 char StringText[MAX_CHAR_PER_LINE + 1]; // don't forget the /0 (end of string)
mverdy 20:626b92b70bf7 264 char StringText2[MAX_CHAR_PER_LINE + 1];
mverdy 20:626b92b70bf7 265 char StringText3[MAX_CHAR_PER_LINE + 1];
mverdy 20:626b92b70bf7 266
mverdy 20:626b92b70bf7 267 /*!
mverdy 20:626b92b70bf7 268 * \brief CurrentPage store current displayed page (cf.: list of availlable
mverdy 20:626b92b70bf7 269 * pages in Menu.h). PeviousPage is used only when navigate through "Radio
mverdy 20:626b92b70bf7 270 * Config" to be able to restore the page before "Radio Congig", witch can be
mverdy 20:626b92b70bf7 271 * PingPong, PER or START_PAGE. The goal is to speed menu navigation.
mverdy 20:626b92b70bf7 272 */
lex9296 21:ab8027016a2c 273 //static uint8_t CurrentPage = START_PAGE;
lex9296 21:ab8027016a2c 274 //static uint8_t PreviousPage = START_PAGE;
mverdy 20:626b92b70bf7 275
mverdy 20:626b92b70bf7 276 /*!
mverdy 20:626b92b70bf7 277 * \brief In "Radio Config Freq", we can update the central frequency. To avoid
mverdy 20:626b92b70bf7 278 * keyboard, we use (+) et (-) keys. CurrentFreqBase is the offset to be applied
mverdy 20:626b92b70bf7 279 * when we increase or decrease the frequency.
mverdy 20:626b92b70bf7 280 */
lex9296 21:ab8027016a2c 281 //static FreqBase CurrentFreqBase = FB100K;
mverdy 20:626b92b70bf7 282
mverdy 20:626b92b70bf7 283
mverdy 20:626b92b70bf7 284 void CheckScreen( void );
mverdy 20:626b92b70bf7 285 void CheckRefresh( void );
mverdy 20:626b92b70bf7 286 void DebouncedScreen( void );
mverdy 20:626b92b70bf7 287 void DrawActiveButton( uint8_t buttonId, uint8_t* text1, uint8_t* text2 );
mverdy 20:626b92b70bf7 288 void ButtonChangeText( uint8_t buttonId, uint8_t* text1, uint8_t* text2 );
mverdy 20:626b92b70bf7 289 void RemoveButton( uint8_t buttonId );
mverdy 20:626b92b70bf7 290 void DrawText( uint8_t lineId, uint8_t* text0, uint8_t* text1, uint8_t* text2 );
mverdy 20:626b92b70bf7 291
mverdy 20:626b92b70bf7 292
mverdy 20:626b92b70bf7 293 void MenuInit( void )
mverdy 20:626b92b70bf7 294 {
mverdy 20:626b92b70bf7 295 DisplayDriverInit( );
mverdy 20:626b92b70bf7 296 GraphObjectDraw( &( MenuObjects[PAGE_BORDER] ), NULL, false, false );
lex9296 21:ab8027016a2c 297 // GraphObjectDraw( &( MenuObjects[TITLE_LINE] ), NULL, false, false );
lex9296 21:ab8027016a2c 298 // MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 299 CheckScreenTouch.attach_us( &CheckScreen, 100000 ); // every 100 ms
mverdy 20:626b92b70bf7 300
mverdy 20:626b92b70bf7 301 // Page Utilities only for GPS and proximity sensor :
mverdy 20:626b92b70bf7 302 CheckPageRefresh.attach_us( &CheckRefresh, 1000000 ); // every 1 s
mverdy 20:626b92b70bf7 303 }
mverdy 20:626b92b70bf7 304
lex9296 21:ab8027016a2c 305 void StabilusMenu (void) {
lex9296 21:ab8027016a2c 306
lex9296 21:ab8027016a2c 307 uint8_t graphObjectTouched = 0xFF;
lex9296 21:ab8027016a2c 308 // static uint8_t refresh = false;
lex9296 21:ab8027016a2c 309
lex9296 21:ab8027016a2c 310 if (CheckScreenFlag == true) {
lex9296 21:ab8027016a2c 311 if (ScreenBeenDebounced == false) {
lex9296 21:ab8027016a2c 312 ScreenBeenDebounced = true;
lex9296 21:ab8027016a2c 313 CheckScreenFlag = false;
lex9296 21:ab8027016a2c 314 DebouncedScreenTouch.attach_us (&DebouncedScreen,
lex9296 21:ab8027016a2c 315 150000); // every 150 ms
lex9296 21:ab8027016a2c 316 GraphObjectTouched (MenuObjects,
lex9296 21:ab8027016a2c 317 GRAPH_OBJECTS_COUNT,
lex9296 21:ab8027016a2c 318 &graphObjectTouched);
lex9296 21:ab8027016a2c 319 }
lex9296 21:ab8027016a2c 320 }
lex9296 21:ab8027016a2c 321
lex9296 21:ab8027016a2c 322 StabilusMainPage( graphObjectTouched );
lex9296 21:ab8027016a2c 323 }
lex9296 21:ab8027016a2c 324
lex9296 21:ab8027016a2c 325 void StabilusMainPage (uint8_t graphObjectTouched) {
lex9296 21:ab8027016a2c 326
lex9296 21:ab8027016a2c 327 uint16_t x, y = 0;
lex9296 21:ab8027016a2c 328 bool touched = false;
lex9296 21:ab8027016a2c 329
lex9296 21:ab8027016a2c 330 // remove all button and text (except title, page border and line)
lex9296 21:ab8027016a2c 331 // and disable all button (touchActive = false).
lex9296 21:ab8027016a2c 332
lex9296 21:ab8027016a2c 333 /*
lex9296 21:ab8027016a2c 334 GraphObject_t clearRect = {NULL,
lex9296 21:ab8027016a2c 335 GO_RECTANGLE, 3, 35, 282, 230, 1,
lex9296 21:ab8027016a2c 336 BACK_COLOR,
lex9296 21:ab8027016a2c 337 BACK_COLOR,
lex9296 21:ab8027016a2c 338 true,
lex9296 21:ab8027016a2c 339 BACK_COLOR,
lex9296 21:ab8027016a2c 340 NULL,
lex9296 21:ab8027016a2c 341 false};
lex9296 21:ab8027016a2c 342 //
lex9296 21:ab8027016a2c 343 GraphObjectClear (&clearRect,
lex9296 21:ab8027016a2c 344 true );
lex9296 21:ab8027016a2c 345 */
lex9296 21:ab8027016a2c 346
lex9296 21:ab8027016a2c 347 // for (uint8_t i = 0; i < GRAPH_OBJECTS_COUNT; i++ ) {
lex9296 21:ab8027016a2c 348 // MenuObjects[i].TouchActive = false;
lex9296 21:ab8027016a2c 349 // }
lex9296 21:ab8027016a2c 350
lex9296 21:ab8027016a2c 351 TouchedXYT (&x, &y, &touched);
lex9296 21:ab8027016a2c 352 sprintf (StringText,
lex9296 21:ab8027016a2c 353 "%d", touched);
lex9296 21:ab8027016a2c 354 sprintf (StringText2,
lex9296 21:ab8027016a2c 355 "%d", x);
lex9296 21:ab8027016a2c 356 sprintf (StringText3,
lex9296 21:ab8027016a2c 357 "%d", y);
lex9296 21:ab8027016a2c 358 DrawText(TITLE_TEXT, (uint8_t*)StringText, NULL, NULL );
lex9296 21:ab8027016a2c 359
lex9296 21:ab8027016a2c 360 // DisplayDriverDrawLogo( SemtechLogo, 20, 37 );
lex9296 21:ab8027016a2c 361 DrawActiveButton( BTN2_BORDER, ( uint8_t* )StringText2, NULL );
lex9296 21:ab8027016a2c 362 DrawActiveButton( BTN3_BORDER, ( uint8_t* )StringText3, NULL );
lex9296 21:ab8027016a2c 363 // DrawActiveButton( BTN4_BORDER, ( uint8_t* )"Outdoor ranging demo", NULL );
lex9296 21:ab8027016a2c 364 // DrawActiveButton( BTN5_BORDER, ( uint8_t* )"Radio Test Modes", NULL );
lex9296 21:ab8027016a2c 365 // DrawActiveButton( BTN6_BORDER, ( uint8_t* )"Radio Settings", NULL );
lex9296 21:ab8027016a2c 366 // DrawActiveButton( BTN7_BORDER, ( uint8_t* )"Utilities", NULL );
lex9296 21:ab8027016a2c 367
lex9296 21:ab8027016a2c 368 // CurrentPage = START_PAGE;
lex9296 21:ab8027016a2c 369 }
lex9296 21:ab8027016a2c 370
lex9296 21:ab8027016a2c 371 /*
mverdy 20:626b92b70bf7 372 uint8_t MenuHandler( bool refresh )
mverdy 20:626b92b70bf7 373 {
mverdy 20:626b92b70bf7 374 uint8_t graphObjectTouched = 0xFF;
mverdy 20:626b92b70bf7 375
mverdy 20:626b92b70bf7 376 if( ( CheckScreenFlag == true ) && ( Eeprom.EepromData.DemoSettings.RngStatus != RNG_PROCESS ) )
mverdy 20:626b92b70bf7 377 {
mverdy 20:626b92b70bf7 378 if( ScreenBeenDebounced == false )
mverdy 20:626b92b70bf7 379 {
mverdy 20:626b92b70bf7 380 ScreenBeenDebounced = true;
mverdy 20:626b92b70bf7 381 CheckScreenFlag = false;
mverdy 20:626b92b70bf7 382 DebouncedScreenTouch.attach_us( &DebouncedScreen, 150000 ); // every 150 ms
mverdy 20:626b92b70bf7 383 GraphObjectTouched( MenuObjects, GRAPH_OBJECTS_COUNT, &graphObjectTouched );
mverdy 20:626b92b70bf7 384 }
mverdy 20:626b92b70bf7 385 }
mverdy 20:626b92b70bf7 386 else
mverdy 20:626b92b70bf7 387 {
mverdy 20:626b92b70bf7 388 // in the Utilities page, GPS infos must be refresh each second
mverdy 20:626b92b70bf7 389 if( CurrentPage == PAGE_UTILITIES )
mverdy 20:626b92b70bf7 390 {
mverdy 20:626b92b70bf7 391 if( PageRefresh == true )
mverdy 20:626b92b70bf7 392 {
mverdy 20:626b92b70bf7 393 PageRefresh = false;
mverdy 20:626b92b70bf7 394 refresh = true;
mverdy 20:626b92b70bf7 395 }
mverdy 20:626b92b70bf7 396 }
mverdy 20:626b92b70bf7 397 }
mverdy 20:626b92b70bf7 398
mverdy 20:626b92b70bf7 399 if( refresh == true )
mverdy 20:626b92b70bf7 400 {
mverdy 20:626b92b70bf7 401 MenuSetPage( CurrentPage );
mverdy 20:626b92b70bf7 402 }
mverdy 20:626b92b70bf7 403 else if( ( graphObjectTouched != 0xFF ) || ( refresh == true ) )
mverdy 20:626b92b70bf7 404 {
mverdy 20:626b92b70bf7 405 switch( CurrentPage )
mverdy 20:626b92b70bf7 406 {
mverdy 20:626b92b70bf7 407 case START_PAGE:
mverdy 20:626b92b70bf7 408 if( graphObjectTouched == BTN2_BORDER )
mverdy 20:626b92b70bf7 409 {
mverdy 20:626b92b70bf7 410 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 411 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING )
mverdy 20:626b92b70bf7 412 {
mverdy 20:626b92b70bf7 413 Eeprom.EepromData.DemoSettings.ModulationType = PACKET_TYPE_LORA;
mverdy 20:626b92b70bf7 414 }
mverdy 20:626b92b70bf7 415 EepromLoadSettings( ( RadioPacketTypes_t )Eeprom.EepromData.DemoSettings.ModulationType );
mverdy 20:626b92b70bf7 416 MenuSetPage( PAGE_PING_PONG );
mverdy 20:626b92b70bf7 417 }
mverdy 20:626b92b70bf7 418 else if( graphObjectTouched == BTN3_BORDER )
mverdy 20:626b92b70bf7 419 {
mverdy 20:626b92b70bf7 420 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 421 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING )
mverdy 20:626b92b70bf7 422 {
mverdy 20:626b92b70bf7 423 Eeprom.EepromData.DemoSettings.ModulationType = PACKET_TYPE_LORA;
mverdy 20:626b92b70bf7 424 }
mverdy 20:626b92b70bf7 425 EepromLoadSettings( ( RadioPacketTypes_t )Eeprom.EepromData.DemoSettings.ModulationType );
mverdy 20:626b92b70bf7 426 MenuSetPage( PAGE_PER );
mverdy 20:626b92b70bf7 427 }
mverdy 20:626b92b70bf7 428 else if( graphObjectTouched == BTN4_BORDER )
mverdy 20:626b92b70bf7 429 {
mverdy 20:626b92b70bf7 430 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 431 EepromLoadSettings( PACKET_TYPE_RANGING );
mverdy 20:626b92b70bf7 432 if( Eeprom.EepromData.DemoSettings.Entity == MASTER )
mverdy 20:626b92b70bf7 433 {
mverdy 20:626b92b70bf7 434 MenuSetPage( PAGE_RANGING_MASTER );
mverdy 20:626b92b70bf7 435 }
mverdy 20:626b92b70bf7 436 else
mverdy 20:626b92b70bf7 437 {
mverdy 20:626b92b70bf7 438 MenuSetPage( PAGE_RANGING_SLAVE );
mverdy 20:626b92b70bf7 439 }
mverdy 20:626b92b70bf7 440 }
mverdy 20:626b92b70bf7 441 else if( graphObjectTouched == BTN5_BORDER )
mverdy 20:626b92b70bf7 442 {
mverdy 20:626b92b70bf7 443 EepromLoadSettings( ( RadioPacketTypes_t )Eeprom.EepromData.DemoSettings.ModulationType );
mverdy 20:626b92b70bf7 444 MenuSetPage( PAGE_RADIO_TEST );
mverdy 20:626b92b70bf7 445 }
mverdy 20:626b92b70bf7 446 else if( graphObjectTouched == BTN6_BORDER )
mverdy 20:626b92b70bf7 447 {
mverdy 20:626b92b70bf7 448 EepromLoadSettings( ( RadioPacketTypes_t )Eeprom.EepromData.DemoSettings.ModulationType );
mverdy 20:626b92b70bf7 449 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 450 }
mverdy 20:626b92b70bf7 451 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 452 {
mverdy 20:626b92b70bf7 453 MenuSetPage( PAGE_UTILITIES );
mverdy 20:626b92b70bf7 454 }
mverdy 20:626b92b70bf7 455 break;
mverdy 20:626b92b70bf7 456
mverdy 20:626b92b70bf7 457 case PAGE_PING_PONG:
mverdy 20:626b92b70bf7 458 if( graphObjectTouched == BTN0_BORDER )
mverdy 20:626b92b70bf7 459 {
mverdy 20:626b92b70bf7 460 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 461 if( Eeprom.EepromData.DemoSettings.Entity == MASTER )
mverdy 20:626b92b70bf7 462 {
mverdy 20:626b92b70bf7 463 Eeprom.EepromData.DemoSettings.Entity = SLAVE;
mverdy 20:626b92b70bf7 464 ButtonChangeText( BTN0_BORDER, ( uint8_t* )" SLAVE", NULL );
mverdy 20:626b92b70bf7 465 DrawText( LINE3_COL0_TEXT, NULL, NULL, ( uint8_t* )" " );
mverdy 20:626b92b70bf7 466 DrawText( LINE4_COL0_TEXT, NULL, NULL, ( uint8_t* )" " );
mverdy 20:626b92b70bf7 467 DrawText( LINE5_COL0_TEXT, NULL, NULL, ( uint8_t* )" " );
mverdy 20:626b92b70bf7 468 DrawText( LINE6_COL0_TEXT, NULL, NULL, ( uint8_t* )" " );
mverdy 20:626b92b70bf7 469 DrawText( LINE7_COL0_TEXT, NULL, NULL, ( uint8_t* )" " );
mverdy 20:626b92b70bf7 470 }
mverdy 20:626b92b70bf7 471 else
mverdy 20:626b92b70bf7 472 {
mverdy 20:626b92b70bf7 473 Eeprom.EepromData.DemoSettings.Entity = MASTER;
mverdy 20:626b92b70bf7 474 ButtonChangeText( BTN0_BORDER, ( uint8_t* )" MASTER", NULL );
mverdy 20:626b92b70bf7 475 DrawText( LINE3_COL0_TEXT, NULL, NULL, ( uint8_t* )"MASTER" );
mverdy 20:626b92b70bf7 476 }
mverdy 20:626b92b70bf7 477 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 478 EepromSaveSettings( DEMO_SETTINGS );
mverdy 20:626b92b70bf7 479 MenuSetPage( PAGE_PING_PONG );
mverdy 20:626b92b70bf7 480 }
mverdy 20:626b92b70bf7 481 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 482 {
mverdy 20:626b92b70bf7 483 StopDemoApplication( );
mverdy 20:626b92b70bf7 484 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 485 PreviousPage = START_PAGE; // clear Previous page
mverdy 20:626b92b70bf7 486 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 487 }
mverdy 20:626b92b70bf7 488 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 489 {
mverdy 20:626b92b70bf7 490 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 491 {
mverdy 20:626b92b70bf7 492 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 493 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" STOP", NULL );
mverdy 20:626b92b70bf7 494 Eeprom.EepromData.DemoSettings.CntPacketTx = 0;
mverdy 20:626b92b70bf7 495 Eeprom.EepromData.DemoSettings.CntPacketRxOK = 0;
mverdy 20:626b92b70bf7 496 Eeprom.EepromData.DemoSettings.CntPacketRxOKSlave = 0;
mverdy 20:626b92b70bf7 497 Eeprom.EepromData.DemoSettings.CntPacketRxKO = 0;
mverdy 20:626b92b70bf7 498 Eeprom.EepromData.DemoSettings.CntPacketRxKOSlave = 0;
mverdy 20:626b92b70bf7 499 Eeprom.EepromData.DemoSettings.RxTimeOutCount = 0;
mverdy 20:626b92b70bf7 500 StopDemoApplication( );
mverdy 20:626b92b70bf7 501 RunDemoApplicationPingPong( );
mverdy 20:626b92b70bf7 502 }
mverdy 20:626b92b70bf7 503 else
mverdy 20:626b92b70bf7 504 {
mverdy 20:626b92b70bf7 505 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 506 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 507 StopDemoApplication( );
mverdy 20:626b92b70bf7 508 wait_ms( 200 ); // debouncing of the touch screen
mverdy 20:626b92b70bf7 509 }
mverdy 20:626b92b70bf7 510 }
mverdy 20:626b92b70bf7 511 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 512 {
mverdy 20:626b92b70bf7 513 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 514 StopDemoApplication( );
mverdy 20:626b92b70bf7 515 // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
mverdy 20:626b92b70bf7 516 // PreviousPage to set next page. Speed up the navigation.
mverdy 20:626b92b70bf7 517 PreviousPage = PAGE_PING_PONG;
mverdy 20:626b92b70bf7 518 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 519 }
mverdy 20:626b92b70bf7 520 else if( refresh == true )
mverdy 20:626b92b70bf7 521 {
mverdy 20:626b92b70bf7 522 MenuSetPage( PAGE_PING_PONG );
mverdy 20:626b92b70bf7 523 }
mverdy 20:626b92b70bf7 524 break;
mverdy 20:626b92b70bf7 525
mverdy 20:626b92b70bf7 526 case PAGE_PER:
mverdy 20:626b92b70bf7 527 if( graphObjectTouched == BTN0_BORDER )
mverdy 20:626b92b70bf7 528 {
mverdy 20:626b92b70bf7 529 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 530 if( Eeprom.EepromData.DemoSettings.Entity == MASTER )
mverdy 20:626b92b70bf7 531 {
mverdy 20:626b92b70bf7 532 Eeprom.EepromData.DemoSettings.Entity = SLAVE;
mverdy 20:626b92b70bf7 533 ButtonChangeText( BTN0_BORDER, ( uint8_t* )" SLAVE", NULL );
mverdy 20:626b92b70bf7 534 DrawText( LINE4_COL0_TEXT, ( uint8_t* )"Rx OK", NULL, NULL );
mverdy 20:626b92b70bf7 535 DrawText( LINE5_COL0_TEXT, ( uint8_t* )"Rx KO", NULL, NULL );
mverdy 20:626b92b70bf7 536 DrawText( LINE6_COL0_TEXT, ( uint8_t* )"PER", NULL, NULL );
mverdy 20:626b92b70bf7 537 DrawText( LINE8_COL0_TEXT, ( uint8_t* )"Last Rssi", NULL, NULL );
mverdy 20:626b92b70bf7 538 DrawText( LINE9_COL0_TEXT, ( uint8_t* )"Last SNR", NULL, NULL );
mverdy 20:626b92b70bf7 539 }
mverdy 20:626b92b70bf7 540 else
mverdy 20:626b92b70bf7 541 {
mverdy 20:626b92b70bf7 542 Eeprom.EepromData.DemoSettings.Entity = MASTER;
mverdy 20:626b92b70bf7 543 ButtonChangeText( BTN0_BORDER, ( uint8_t* )" MASTER", NULL );
mverdy 20:626b92b70bf7 544 DrawText( LINE4_COL0_TEXT, ( uint8_t* )"Transmitted", ( uint8_t* )GetMenuDemoNumSentPacket( ), NULL );
mverdy 20:626b92b70bf7 545 DrawText( LINE5_COL0_TEXT, ( uint8_t* )" ", ( uint8_t* )" ", NULL );
mverdy 20:626b92b70bf7 546 DrawText( LINE6_COL0_TEXT, ( uint8_t* )" ", ( uint8_t* )" ", NULL );
mverdy 20:626b92b70bf7 547 DrawText( LINE8_COL0_TEXT, ( uint8_t* )" ", ( uint8_t* )" ", NULL );
mverdy 20:626b92b70bf7 548 DrawText( LINE9_COL0_TEXT, ( uint8_t* )" ", ( uint8_t* )" ", NULL );
mverdy 20:626b92b70bf7 549 }
mverdy 20:626b92b70bf7 550 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 551 EepromSaveSettings( DEMO_SETTINGS );
mverdy 20:626b92b70bf7 552 MenuSetPage( PAGE_PER );
mverdy 20:626b92b70bf7 553 }
mverdy 20:626b92b70bf7 554 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 555 {
mverdy 20:626b92b70bf7 556 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 557 PreviousPage = START_PAGE; // clear Previous page
mverdy 20:626b92b70bf7 558 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 559 }
mverdy 20:626b92b70bf7 560 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 561 {
mverdy 20:626b92b70bf7 562 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 563 {
mverdy 20:626b92b70bf7 564 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 565 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" STOP", NULL );
mverdy 20:626b92b70bf7 566 StopDemoApplication( );
mverdy 20:626b92b70bf7 567 Eeprom.EepromData.DemoSettings.CntPacketTx = 0;
mverdy 20:626b92b70bf7 568 Eeprom.EepromData.DemoSettings.CntPacketRxOK = 0;
mverdy 20:626b92b70bf7 569 Eeprom.EepromData.DemoSettings.CntPacketRxKO = 0;
mverdy 20:626b92b70bf7 570 Eeprom.EepromData.DemoSettings.RxTimeOutCount = 0;
mverdy 20:626b92b70bf7 571 RunDemoApplicationPer( );
mverdy 20:626b92b70bf7 572 }
mverdy 20:626b92b70bf7 573 else
mverdy 20:626b92b70bf7 574 {
mverdy 20:626b92b70bf7 575 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 576 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 577 StopDemoApplication( );
mverdy 20:626b92b70bf7 578 wait_ms( 200 ); // debouncing of the touch screen
mverdy 20:626b92b70bf7 579 }
mverdy 20:626b92b70bf7 580 }
mverdy 20:626b92b70bf7 581 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 582 {
mverdy 20:626b92b70bf7 583 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 584 StopDemoApplication( );
mverdy 20:626b92b70bf7 585 // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
mverdy 20:626b92b70bf7 586 // PreviousPage to set next page. Speed up the navigation.
mverdy 20:626b92b70bf7 587 PreviousPage = PAGE_PER;
mverdy 20:626b92b70bf7 588 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 589 }
mverdy 20:626b92b70bf7 590 else if( refresh == true )
mverdy 20:626b92b70bf7 591 {
mverdy 20:626b92b70bf7 592 MenuSetPage( PAGE_PER );
mverdy 20:626b92b70bf7 593 }
mverdy 20:626b92b70bf7 594 break;
mverdy 20:626b92b70bf7 595
mverdy 20:626b92b70bf7 596 case PAGE_RANGING_MASTER:
mverdy 20:626b92b70bf7 597 if( graphObjectTouched == BTN0_BORDER )
mverdy 20:626b92b70bf7 598 {
mverdy 20:626b92b70bf7 599 Eeprom.EepromData.DemoSettings.Entity = SLAVE;
mverdy 20:626b92b70bf7 600 ButtonChangeText( BTN0_BORDER, ( uint8_t* )" SLAVE", NULL );
mverdy 20:626b92b70bf7 601 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 602 StopDemoApplication( );
mverdy 20:626b92b70bf7 603 EepromSaveSettings( DEMO_SETTINGS );
mverdy 20:626b92b70bf7 604 MenuSetPage( PAGE_RANGING_SLAVE );
mverdy 20:626b92b70bf7 605 }
mverdy 20:626b92b70bf7 606 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 607 {
mverdy 20:626b92b70bf7 608 StopDemoApplication( );
mverdy 20:626b92b70bf7 609 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 610 PreviousPage = START_PAGE; // clear Previous page
mverdy 20:626b92b70bf7 611 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 612 }
mverdy 20:626b92b70bf7 613 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 614 {
mverdy 20:626b92b70bf7 615 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 616 {
mverdy 20:626b92b70bf7 617 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 618 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" PROCESS..", NULL );
mverdy 20:626b92b70bf7 619 }
mverdy 20:626b92b70bf7 620 else
mverdy 20:626b92b70bf7 621 {
mverdy 20:626b92b70bf7 622 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 623 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" REFRESH", NULL );
mverdy 20:626b92b70bf7 624 StopDemoApplication( );
mverdy 20:626b92b70bf7 625 }
mverdy 20:626b92b70bf7 626 }
mverdy 20:626b92b70bf7 627 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 628 {
mverdy 20:626b92b70bf7 629 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 630 // "SETTINGS" button can occure without "START"/"STOP" button
mverdy 20:626b92b70bf7 631 // also "SETTINGS" should stop the demo
mverdy 20:626b92b70bf7 632 StopDemoApplication( );
mverdy 20:626b92b70bf7 633 // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
mverdy 20:626b92b70bf7 634 // PreviousPage to set next page. Speed up the navigation.
mverdy 20:626b92b70bf7 635 PreviousPage = PAGE_RANGING_MASTER;
mverdy 20:626b92b70bf7 636 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 637 }
mverdy 20:626b92b70bf7 638 else if( graphObjectTouched == RNG_MST_SCR )
mverdy 20:626b92b70bf7 639 {
mverdy 20:626b92b70bf7 640 // screen touched .. launch new measure
mverdy 20:626b92b70bf7 641 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 642 {
mverdy 20:626b92b70bf7 643 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 644 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" PROCESS..", NULL );
mverdy 20:626b92b70bf7 645 }
mverdy 20:626b92b70bf7 646 else
mverdy 20:626b92b70bf7 647 {
mverdy 20:626b92b70bf7 648 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 649 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" REFRESH", NULL );
mverdy 20:626b92b70bf7 650 StopDemoApplication( );
mverdy 20:626b92b70bf7 651 }
mverdy 20:626b92b70bf7 652 }
mverdy 20:626b92b70bf7 653 else if( refresh == true )
mverdy 20:626b92b70bf7 654 {
mverdy 20:626b92b70bf7 655 MenuSetPage( PAGE_RANGING_MASTER );
mverdy 20:626b92b70bf7 656 }
mverdy 20:626b92b70bf7 657 break;
mverdy 20:626b92b70bf7 658
mverdy 20:626b92b70bf7 659 case PAGE_RANGING_SLAVE:
mverdy 20:626b92b70bf7 660 if( graphObjectTouched == BTN0_BORDER )
mverdy 20:626b92b70bf7 661 {
mverdy 20:626b92b70bf7 662 Eeprom.EepromData.DemoSettings.Entity = MASTER;
mverdy 20:626b92b70bf7 663 ButtonChangeText( BTN0_BORDER, ( uint8_t* )" MASTER", NULL );
mverdy 20:626b92b70bf7 664 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 665 StopDemoApplication( );
mverdy 20:626b92b70bf7 666 EepromSaveSettings( DEMO_SETTINGS );
mverdy 20:626b92b70bf7 667 MenuSetPage( PAGE_RANGING_MASTER );
mverdy 20:626b92b70bf7 668 }
mverdy 20:626b92b70bf7 669 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 670 {
mverdy 20:626b92b70bf7 671 StopDemoApplication( );
mverdy 20:626b92b70bf7 672 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 673 PreviousPage = START_PAGE; // clear Previous page
mverdy 20:626b92b70bf7 674 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 675 }
mverdy 20:626b92b70bf7 676 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 677 {
mverdy 20:626b92b70bf7 678 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 679 {
mverdy 20:626b92b70bf7 680 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 681 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" STOP", NULL );
mverdy 20:626b92b70bf7 682 StopDemoApplication( );
mverdy 20:626b92b70bf7 683 RunDemoApplicationRanging( );
mverdy 20:626b92b70bf7 684 }
mverdy 20:626b92b70bf7 685 else
mverdy 20:626b92b70bf7 686 {
mverdy 20:626b92b70bf7 687 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 688 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 689 StopDemoApplication( );
mverdy 20:626b92b70bf7 690 }
mverdy 20:626b92b70bf7 691 }
mverdy 20:626b92b70bf7 692 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 693 {
mverdy 20:626b92b70bf7 694 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 695 // "SETTINGS" button can occure without "START"/"STOP" button
mverdy 20:626b92b70bf7 696 // also "SETTINGS" should stop the demo
mverdy 20:626b92b70bf7 697 StopDemoApplication( );
mverdy 20:626b92b70bf7 698 // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
mverdy 20:626b92b70bf7 699 // PreviousPage to set next page. Speed up the navigation.
mverdy 20:626b92b70bf7 700 PreviousPage = PAGE_RANGING_SLAVE;
mverdy 20:626b92b70bf7 701 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 702 }
mverdy 20:626b92b70bf7 703 else if( refresh == true )
mverdy 20:626b92b70bf7 704 {
mverdy 20:626b92b70bf7 705 MenuSetPage( PAGE_RANGING_SLAVE );
mverdy 20:626b92b70bf7 706 }
mverdy 20:626b92b70bf7 707 break;
mverdy 20:626b92b70bf7 708
mverdy 20:626b92b70bf7 709 case PAGE_RADIO_PARAM:
mverdy 20:626b92b70bf7 710 if( graphObjectTouched == BTN0_BORDER )
mverdy 20:626b92b70bf7 711 {
mverdy 20:626b92b70bf7 712 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_LORA )
mverdy 20:626b92b70bf7 713 {
mverdy 20:626b92b70bf7 714 Eeprom.EepromData.DemoSettings.ModulationType = PACKET_TYPE_FLRC;
mverdy 20:626b92b70bf7 715 }
mverdy 20:626b92b70bf7 716 else if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
mverdy 20:626b92b70bf7 717 {
mverdy 20:626b92b70bf7 718 Eeprom.EepromData.DemoSettings.ModulationType = PACKET_TYPE_GFSK;
mverdy 20:626b92b70bf7 719 }
mverdy 20:626b92b70bf7 720 else if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_GFSK )
mverdy 20:626b92b70bf7 721 {
mverdy 20:626b92b70bf7 722 if( PreviousPage == START_PAGE )
mverdy 20:626b92b70bf7 723 {
mverdy 20:626b92b70bf7 724 Eeprom.EepromData.DemoSettings.ModulationType = PACKET_TYPE_RANGING;
mverdy 20:626b92b70bf7 725 }
mverdy 20:626b92b70bf7 726 else
mverdy 20:626b92b70bf7 727 {
mverdy 20:626b92b70bf7 728 Eeprom.EepromData.DemoSettings.ModulationType = PACKET_TYPE_LORA;
mverdy 20:626b92b70bf7 729 }
mverdy 20:626b92b70bf7 730 }
mverdy 20:626b92b70bf7 731 else // PACKET_TYPE_RANGING
mverdy 20:626b92b70bf7 732 {
mverdy 20:626b92b70bf7 733 if( PreviousPage == START_PAGE )
mverdy 20:626b92b70bf7 734 {
mverdy 20:626b92b70bf7 735 Eeprom.EepromData.DemoSettings.ModulationType = PACKET_TYPE_LORA;
mverdy 20:626b92b70bf7 736 }
mverdy 20:626b92b70bf7 737 }
mverdy 20:626b92b70bf7 738 EepromLoadSettings( ( RadioPacketTypes_t )Eeprom.EepromData.DemoSettings.ModulationType );
mverdy 20:626b92b70bf7 739 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 740 }
mverdy 20:626b92b70bf7 741 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 742 {
mverdy 20:626b92b70bf7 743 EepromSetRangingDefaultSettings( );
mverdy 20:626b92b70bf7 744 EepromLoadSettings( PACKET_TYPE_RANGING );
mverdy 20:626b92b70bf7 745 ButtonChangeText( BTN3_BORDER, NULL, ( uint8_t* )GetRadioModulationParameters1( ) );
mverdy 20:626b92b70bf7 746 ButtonChangeText( BTN4_BORDER, NULL, ( uint8_t* )GetRadioModulationParameters2( ) );
mverdy 20:626b92b70bf7 747 ButtonChangeText( BTN5_BORDER, NULL, ( uint8_t* )GetRadioModulationParameters3( ) );
mverdy 20:626b92b70bf7 748 }
mverdy 20:626b92b70bf7 749 else if( graphObjectTouched == BTN1_BORDER )
mverdy 20:626b92b70bf7 750 {
mverdy 20:626b92b70bf7 751 MenuSetPage( PAGE_RADIO_PARAM_FREQ );
mverdy 20:626b92b70bf7 752 }
mverdy 20:626b92b70bf7 753 else if( graphObjectTouched == BTN2_BORDER )
mverdy 20:626b92b70bf7 754 {
mverdy 20:626b92b70bf7 755 Eeprom.EepromData.DemoSettings.TxPower += 1;
mverdy 20:626b92b70bf7 756 if( Eeprom.EepromData.DemoSettings.TxPower > DEMO_POWER_TX_MAX )
mverdy 20:626b92b70bf7 757 {
mverdy 20:626b92b70bf7 758 Eeprom.EepromData.DemoSettings.TxPower = DEMO_POWER_TX_MIN;
mverdy 20:626b92b70bf7 759 }
mverdy 20:626b92b70bf7 760 ButtonChangeText( BTN2_BORDER, NULL, ( uint8_t* )GetRadioTxPower( ) );
mverdy 20:626b92b70bf7 761 }
mverdy 20:626b92b70bf7 762 else if( graphObjectTouched == BTN3_BORDER )
mverdy 20:626b92b70bf7 763 {
mverdy 20:626b92b70bf7 764 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_LORA )
mverdy 20:626b92b70bf7 765 {
mverdy 20:626b92b70bf7 766 if( Eeprom.EepromData.DemoSettings.ModulationParam1 < LORA_SF12 )
mverdy 20:626b92b70bf7 767 {
mverdy 20:626b92b70bf7 768 Eeprom.EepromData.DemoSettings.ModulationParam1 = Eeprom.EepromData.DemoSettings.ModulationParam1 + 0x10;
mverdy 20:626b92b70bf7 769 }
mverdy 20:626b92b70bf7 770 else
mverdy 20:626b92b70bf7 771 {
mverdy 20:626b92b70bf7 772 Eeprom.EepromData.DemoSettings.ModulationParam1 = LORA_SF5;
mverdy 20:626b92b70bf7 773 }
mverdy 20:626b92b70bf7 774 }
mverdy 20:626b92b70bf7 775 else if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING )
mverdy 20:626b92b70bf7 776 {
mverdy 20:626b92b70bf7 777 if( Eeprom.EepromData.DemoSettings.ModulationParam1 < LORA_SF10 )
mverdy 20:626b92b70bf7 778 {
mverdy 20:626b92b70bf7 779 Eeprom.EepromData.DemoSettings.ModulationParam1 = Eeprom.EepromData.DemoSettings.ModulationParam1 + 0x10;
mverdy 20:626b92b70bf7 780 }
mverdy 20:626b92b70bf7 781 else
mverdy 20:626b92b70bf7 782 {
mverdy 20:626b92b70bf7 783 Eeprom.EepromData.DemoSettings.ModulationParam1 = LORA_SF5;
mverdy 20:626b92b70bf7 784 }
mverdy 20:626b92b70bf7 785 }
mverdy 20:626b92b70bf7 786 else if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
mverdy 20:626b92b70bf7 787 {
mverdy 20:626b92b70bf7 788 switch( Eeprom.EepromData.DemoSettings.ModulationParam1 )
mverdy 20:626b92b70bf7 789 {
mverdy 20:626b92b70bf7 790 case FLRC_BR_1_300_BW_1_2:
mverdy 20:626b92b70bf7 791 Eeprom.EepromData.DemoSettings.ModulationParam1 = FLRC_BR_1_040_BW_1_2;
mverdy 20:626b92b70bf7 792 break;
mverdy 20:626b92b70bf7 793
mverdy 20:626b92b70bf7 794 case FLRC_BR_1_040_BW_1_2:
mverdy 20:626b92b70bf7 795 Eeprom.EepromData.DemoSettings.ModulationParam1 = FLRC_BR_0_650_BW_0_6;
mverdy 20:626b92b70bf7 796 break;
mverdy 20:626b92b70bf7 797
mverdy 20:626b92b70bf7 798 case FLRC_BR_0_650_BW_0_6:
mverdy 20:626b92b70bf7 799 Eeprom.EepromData.DemoSettings.ModulationParam1 = FLRC_BR_0_520_BW_0_6;
mverdy 20:626b92b70bf7 800 break;
mverdy 20:626b92b70bf7 801
mverdy 20:626b92b70bf7 802 case FLRC_BR_0_520_BW_0_6:
mverdy 20:626b92b70bf7 803 Eeprom.EepromData.DemoSettings.ModulationParam1 = FLRC_BR_0_325_BW_0_3;
mverdy 20:626b92b70bf7 804 break;
mverdy 20:626b92b70bf7 805
mverdy 20:626b92b70bf7 806 case FLRC_BR_0_325_BW_0_3:
mverdy 20:626b92b70bf7 807 Eeprom.EepromData.DemoSettings.ModulationParam1 = FLRC_BR_0_260_BW_0_3;
mverdy 20:626b92b70bf7 808 break;
mverdy 20:626b92b70bf7 809
mverdy 20:626b92b70bf7 810 case FLRC_BR_0_260_BW_0_3:
mverdy 20:626b92b70bf7 811 Eeprom.EepromData.DemoSettings.ModulationParam1 = FLRC_BR_1_300_BW_1_2;
mverdy 20:626b92b70bf7 812 break;
mverdy 20:626b92b70bf7 813 }
mverdy 20:626b92b70bf7 814 }
mverdy 20:626b92b70bf7 815 else // PACKET_TYPE_GFSK
mverdy 20:626b92b70bf7 816 {
mverdy 20:626b92b70bf7 817 switch( Eeprom.EepromData.DemoSettings.ModulationParam1 )
mverdy 20:626b92b70bf7 818 {
mverdy 20:626b92b70bf7 819 case GFSK_BLE_BR_2_000_BW_2_4:
mverdy 20:626b92b70bf7 820 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_1_600_BW_2_4;
mverdy 20:626b92b70bf7 821 break;
mverdy 20:626b92b70bf7 822
mverdy 20:626b92b70bf7 823 case GFSK_BLE_BR_1_600_BW_2_4:
mverdy 20:626b92b70bf7 824 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_1_000_BW_2_4;
mverdy 20:626b92b70bf7 825 break;
mverdy 20:626b92b70bf7 826
mverdy 20:626b92b70bf7 827 case GFSK_BLE_BR_1_000_BW_2_4:
mverdy 20:626b92b70bf7 828 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_1_000_BW_1_2;
mverdy 20:626b92b70bf7 829 break;
mverdy 20:626b92b70bf7 830
mverdy 20:626b92b70bf7 831 case GFSK_BLE_BR_1_000_BW_1_2:
mverdy 20:626b92b70bf7 832 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_0_800_BW_2_4;
mverdy 20:626b92b70bf7 833 break;
mverdy 20:626b92b70bf7 834
mverdy 20:626b92b70bf7 835 case GFSK_BLE_BR_0_800_BW_2_4:
mverdy 20:626b92b70bf7 836 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_0_800_BW_1_2;
mverdy 20:626b92b70bf7 837 break;
mverdy 20:626b92b70bf7 838
mverdy 20:626b92b70bf7 839 case GFSK_BLE_BR_0_800_BW_1_2:
mverdy 20:626b92b70bf7 840 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_0_500_BW_1_2;
mverdy 20:626b92b70bf7 841 break;
mverdy 20:626b92b70bf7 842
mverdy 20:626b92b70bf7 843 case GFSK_BLE_BR_0_500_BW_1_2:
mverdy 20:626b92b70bf7 844 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_0_500_BW_0_6;
mverdy 20:626b92b70bf7 845 break;
mverdy 20:626b92b70bf7 846
mverdy 20:626b92b70bf7 847 case GFSK_BLE_BR_0_500_BW_0_6:
mverdy 20:626b92b70bf7 848 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_0_400_BW_1_2;
mverdy 20:626b92b70bf7 849 break;
mverdy 20:626b92b70bf7 850
mverdy 20:626b92b70bf7 851 case GFSK_BLE_BR_0_400_BW_1_2:
mverdy 20:626b92b70bf7 852 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_0_400_BW_0_6;
mverdy 20:626b92b70bf7 853 break;
mverdy 20:626b92b70bf7 854
mverdy 20:626b92b70bf7 855 case GFSK_BLE_BR_0_400_BW_0_6:
mverdy 20:626b92b70bf7 856 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_0_250_BW_0_6;
mverdy 20:626b92b70bf7 857 break;
mverdy 20:626b92b70bf7 858
mverdy 20:626b92b70bf7 859 case GFSK_BLE_BR_0_250_BW_0_6:
mverdy 20:626b92b70bf7 860 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_0_250_BW_0_3;
mverdy 20:626b92b70bf7 861 break;
mverdy 20:626b92b70bf7 862
mverdy 20:626b92b70bf7 863 case GFSK_BLE_BR_0_250_BW_0_3:
mverdy 20:626b92b70bf7 864 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_0_125_BW_0_3;
mverdy 20:626b92b70bf7 865 break;
mverdy 20:626b92b70bf7 866
mverdy 20:626b92b70bf7 867 case GFSK_BLE_BR_0_125_BW_0_3:
mverdy 20:626b92b70bf7 868 Eeprom.EepromData.DemoSettings.ModulationParam1 = GFSK_BLE_BR_2_000_BW_2_4;
mverdy 20:626b92b70bf7 869 break;
mverdy 20:626b92b70bf7 870 }
mverdy 20:626b92b70bf7 871 }
mverdy 20:626b92b70bf7 872 ButtonChangeText( BTN3_BORDER, NULL, ( uint8_t* )GetRadioModulationParameters1( ) );
mverdy 20:626b92b70bf7 873 }
mverdy 20:626b92b70bf7 874 else if( graphObjectTouched == BTN4_BORDER )
mverdy 20:626b92b70bf7 875 {
mverdy 20:626b92b70bf7 876 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_LORA )
mverdy 20:626b92b70bf7 877 {
mverdy 20:626b92b70bf7 878 switch( Eeprom.EepromData.DemoSettings.ModulationParam2 )
mverdy 20:626b92b70bf7 879 {
mverdy 20:626b92b70bf7 880 case LORA_BW_0200:
mverdy 20:626b92b70bf7 881 Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_0400;
mverdy 20:626b92b70bf7 882 break;
mverdy 20:626b92b70bf7 883
mverdy 20:626b92b70bf7 884 case LORA_BW_0400:
mverdy 20:626b92b70bf7 885 Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_0800;
mverdy 20:626b92b70bf7 886 break;
mverdy 20:626b92b70bf7 887
mverdy 20:626b92b70bf7 888 case LORA_BW_0800:
mverdy 20:626b92b70bf7 889 Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_1600;
mverdy 20:626b92b70bf7 890 break;
mverdy 20:626b92b70bf7 891
mverdy 20:626b92b70bf7 892 case LORA_BW_1600:
mverdy 20:626b92b70bf7 893 Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_0200;
mverdy 20:626b92b70bf7 894 break;
mverdy 20:626b92b70bf7 895 }
mverdy 20:626b92b70bf7 896 }
mverdy 20:626b92b70bf7 897 else if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING )
mverdy 20:626b92b70bf7 898 {
mverdy 20:626b92b70bf7 899 switch( Eeprom.EepromData.DemoSettings.ModulationParam2 )
mverdy 20:626b92b70bf7 900 {
mverdy 20:626b92b70bf7 901 case LORA_BW_0400:
mverdy 20:626b92b70bf7 902 Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_0800;
mverdy 20:626b92b70bf7 903 break;
mverdy 20:626b92b70bf7 904
mverdy 20:626b92b70bf7 905 case LORA_BW_0800:
mverdy 20:626b92b70bf7 906 Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_1600;
mverdy 20:626b92b70bf7 907 break;
mverdy 20:626b92b70bf7 908
mverdy 20:626b92b70bf7 909 case LORA_BW_1600:
mverdy 20:626b92b70bf7 910 Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_0400;
mverdy 20:626b92b70bf7 911 break;
mverdy 20:626b92b70bf7 912 }
mverdy 20:626b92b70bf7 913 }
mverdy 20:626b92b70bf7 914 else if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
mverdy 20:626b92b70bf7 915 {
mverdy 20:626b92b70bf7 916 if( Eeprom.EepromData.DemoSettings.ModulationParam2 < FLRC_CR_1_0 )
mverdy 20:626b92b70bf7 917 {
mverdy 20:626b92b70bf7 918 Eeprom.EepromData.DemoSettings.ModulationParam2 = Eeprom.EepromData.DemoSettings.ModulationParam2 + 2;;
mverdy 20:626b92b70bf7 919 }
mverdy 20:626b92b70bf7 920 else
mverdy 20:626b92b70bf7 921 {
mverdy 20:626b92b70bf7 922 Eeprom.EepromData.DemoSettings.ModulationParam2 = FLRC_CR_1_2;
mverdy 20:626b92b70bf7 923 }
mverdy 20:626b92b70bf7 924 }
mverdy 20:626b92b70bf7 925 else // PACKET_TYPE_GFSK
mverdy 20:626b92b70bf7 926 {
mverdy 20:626b92b70bf7 927 if( Eeprom.EepromData.DemoSettings.ModulationParam2 < GFSK_BLE_MOD_IND_4_00 )
mverdy 20:626b92b70bf7 928 {
mverdy 20:626b92b70bf7 929 Eeprom.EepromData.DemoSettings.ModulationParam2++;
mverdy 20:626b92b70bf7 930 }
mverdy 20:626b92b70bf7 931 else
mverdy 20:626b92b70bf7 932 {
mverdy 20:626b92b70bf7 933 Eeprom.EepromData.DemoSettings.ModulationParam2 = GFSK_BLE_MOD_IND_0_35;
mverdy 20:626b92b70bf7 934 }
mverdy 20:626b92b70bf7 935 }
mverdy 20:626b92b70bf7 936 ButtonChangeText( BTN4_BORDER, NULL, ( uint8_t* )GetRadioModulationParameters2( ) );
mverdy 20:626b92b70bf7 937 }
mverdy 20:626b92b70bf7 938 else if( graphObjectTouched == BTN5_BORDER )
mverdy 20:626b92b70bf7 939 {
mverdy 20:626b92b70bf7 940 if( ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_LORA ) || \
mverdy 20:626b92b70bf7 941 ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING ) )
mverdy 20:626b92b70bf7 942 {
mverdy 20:626b92b70bf7 943 if( Eeprom.EepromData.DemoSettings.ModulationParam3 < LORA_CR_LI_4_7 )
mverdy 20:626b92b70bf7 944 {
mverdy 20:626b92b70bf7 945 Eeprom.EepromData.DemoSettings.ModulationParam3++;
mverdy 20:626b92b70bf7 946 }
mverdy 20:626b92b70bf7 947 else
mverdy 20:626b92b70bf7 948 {
mverdy 20:626b92b70bf7 949 Eeprom.EepromData.DemoSettings.ModulationParam3 = LORA_CR_4_5;
mverdy 20:626b92b70bf7 950 }
mverdy 20:626b92b70bf7 951 }
mverdy 20:626b92b70bf7 952 else // PACKET_TYPE_GFSK and PACKET_TYPE_FLRC
mverdy 20:626b92b70bf7 953 {
mverdy 20:626b92b70bf7 954 if( Eeprom.EepromData.DemoSettings.ModulationParam3 < RADIO_MOD_SHAPING_BT_0_5 )
mverdy 20:626b92b70bf7 955 {
mverdy 20:626b92b70bf7 956 Eeprom.EepromData.DemoSettings.ModulationParam3 = Eeprom.EepromData.DemoSettings.ModulationParam3 + 0x10;
mverdy 20:626b92b70bf7 957 }
mverdy 20:626b92b70bf7 958 else
mverdy 20:626b92b70bf7 959 {
mverdy 20:626b92b70bf7 960 Eeprom.EepromData.DemoSettings.ModulationParam3 = RADIO_MOD_SHAPING_BT_OFF;
mverdy 20:626b92b70bf7 961 }
mverdy 20:626b92b70bf7 962 }
mverdy 20:626b92b70bf7 963 ButtonChangeText( BTN5_BORDER, NULL, ( uint8_t* )GetRadioModulationParameters3( ) );
mverdy 20:626b92b70bf7 964 }
mverdy 20:626b92b70bf7 965 else if( graphObjectTouched == BTN6_BORDER )
mverdy 20:626b92b70bf7 966 {
mverdy 20:626b92b70bf7 967 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_LORA )
mverdy 20:626b92b70bf7 968 {
mverdy 20:626b92b70bf7 969 if( Eeprom.EepromData.DemoSettings.PacketParam3 < 32 )
mverdy 20:626b92b70bf7 970 {
mverdy 20:626b92b70bf7 971 Eeprom.EepromData.DemoSettings.PacketParam3++;
mverdy 20:626b92b70bf7 972 }
mverdy 20:626b92b70bf7 973 else if( Eeprom.EepromData.DemoSettings.PacketParam3 <= ( DEMO_GFS_LORA_MAX_PAYLOAD - 8 ) )
mverdy 20:626b92b70bf7 974 {
mverdy 20:626b92b70bf7 975 Eeprom.EepromData.DemoSettings.PacketParam3 += 8;
mverdy 20:626b92b70bf7 976 }
mverdy 20:626b92b70bf7 977 else
mverdy 20:626b92b70bf7 978 {
mverdy 20:626b92b70bf7 979 Eeprom.EepromData.DemoSettings.PacketParam3 = DEMO_MIN_PAYLOAD;
mverdy 20:626b92b70bf7 980 }
mverdy 20:626b92b70bf7 981 }
mverdy 20:626b92b70bf7 982 else if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
mverdy 20:626b92b70bf7 983 {
mverdy 20:626b92b70bf7 984 if( Eeprom.EepromData.DemoSettings.PacketParam5 < 32 )
mverdy 20:626b92b70bf7 985 {
mverdy 20:626b92b70bf7 986 Eeprom.EepromData.DemoSettings.PacketParam5++;
mverdy 20:626b92b70bf7 987 }
mverdy 20:626b92b70bf7 988 else if( Eeprom.EepromData.DemoSettings.PacketParam5 <= ( DEMO_FLRC_MAX_PAYLOAD - 8 ) )
mverdy 20:626b92b70bf7 989 {
mverdy 20:626b92b70bf7 990 Eeprom.EepromData.DemoSettings.PacketParam5 += 8;
mverdy 20:626b92b70bf7 991 }
mverdy 20:626b92b70bf7 992 else
mverdy 20:626b92b70bf7 993 {
mverdy 20:626b92b70bf7 994 Eeprom.EepromData.DemoSettings.PacketParam5 = DEMO_MIN_PAYLOAD;
mverdy 20:626b92b70bf7 995 }
mverdy 20:626b92b70bf7 996 }
mverdy 20:626b92b70bf7 997 else if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_GFSK )
mverdy 20:626b92b70bf7 998 {
mverdy 20:626b92b70bf7 999 if( Eeprom.EepromData.DemoSettings.PacketParam5 < 32 )
mverdy 20:626b92b70bf7 1000 {
mverdy 20:626b92b70bf7 1001 Eeprom.EepromData.DemoSettings.PacketParam5++;
mverdy 20:626b92b70bf7 1002 }
mverdy 20:626b92b70bf7 1003 else if( Eeprom.EepromData.DemoSettings.PacketParam5 <= ( DEMO_GFS_LORA_MAX_PAYLOAD - 8 ) )
mverdy 20:626b92b70bf7 1004 {
mverdy 20:626b92b70bf7 1005 Eeprom.EepromData.DemoSettings.PacketParam5 += 8;
mverdy 20:626b92b70bf7 1006 }
mverdy 20:626b92b70bf7 1007 else
mverdy 20:626b92b70bf7 1008 {
mverdy 20:626b92b70bf7 1009 Eeprom.EepromData.DemoSettings.PacketParam5 = DEMO_MIN_PAYLOAD;
mverdy 20:626b92b70bf7 1010 }
mverdy 20:626b92b70bf7 1011 }
mverdy 20:626b92b70bf7 1012 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING )
mverdy 20:626b92b70bf7 1013 {
mverdy 20:626b92b70bf7 1014 MenuSetPage( PAGE_RANGING_PARAM );
mverdy 20:626b92b70bf7 1015 }
mverdy 20:626b92b70bf7 1016 else
mverdy 20:626b92b70bf7 1017 {
mverdy 20:626b92b70bf7 1018 ButtonChangeText( BTN6_BORDER, NULL, ( uint8_t* )GetRadioPayloadLength( ) );
mverdy 20:626b92b70bf7 1019 }
mverdy 20:626b92b70bf7 1020 }
mverdy 20:626b92b70bf7 1021 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1022 {
mverdy 20:626b92b70bf7 1023 uint8_t modTmp = Eeprom.EepromData.DemoSettings.ModulationType;
mverdy 20:626b92b70bf7 1024
mverdy 20:626b92b70bf7 1025 EepromMcuReadBuffer( 0, Eeprom.Buffer, EEPROM_BUFFER_SIZE );
mverdy 20:626b92b70bf7 1026 EepromLoadGeneralSettings( );
mverdy 20:626b92b70bf7 1027 EepromLoadSettings( ( RadioPacketTypes_t )modTmp );
mverdy 20:626b92b70bf7 1028 MenuSetPage( PreviousPage );
mverdy 20:626b92b70bf7 1029 }
mverdy 20:626b92b70bf7 1030 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 1031 {
mverdy 20:626b92b70bf7 1032 switch( Eeprom.EepromData.DemoSettings.ModulationType )
mverdy 20:626b92b70bf7 1033 {
mverdy 20:626b92b70bf7 1034 case PACKET_TYPE_RANGING:
mverdy 20:626b92b70bf7 1035 EepromSaveSettings( RADIO_RANGING_PARAMS );
mverdy 20:626b92b70bf7 1036 break;
mverdy 20:626b92b70bf7 1037
mverdy 20:626b92b70bf7 1038 case PACKET_TYPE_LORA:
mverdy 20:626b92b70bf7 1039 EepromSaveSettings( RADIO_LORA_PARAMS );
mverdy 20:626b92b70bf7 1040 break;
mverdy 20:626b92b70bf7 1041
mverdy 20:626b92b70bf7 1042 case PACKET_TYPE_FLRC:
mverdy 20:626b92b70bf7 1043 EepromSaveSettings( RADIO_FLRC_PARAMS );
mverdy 20:626b92b70bf7 1044 break;
mverdy 20:626b92b70bf7 1045
mverdy 20:626b92b70bf7 1046 case PACKET_TYPE_GFSK:
mverdy 20:626b92b70bf7 1047 EepromSaveSettings( RADIO_GFSK_PARAMS );
mverdy 20:626b92b70bf7 1048 break;
mverdy 20:626b92b70bf7 1049 }
mverdy 20:626b92b70bf7 1050 EepromSaveSettings( DEMO_SETTINGS );
mverdy 20:626b92b70bf7 1051 MenuSetPage( PreviousPage );
mverdy 20:626b92b70bf7 1052 }
mverdy 20:626b92b70bf7 1053 break;
mverdy 20:626b92b70bf7 1054
mverdy 20:626b92b70bf7 1055 case PAGE_RANGING_PARAM:
mverdy 20:626b92b70bf7 1056 if( graphObjectTouched == BTN1_BORDER )
mverdy 20:626b92b70bf7 1057 {
mverdy 20:626b92b70bf7 1058 Eeprom.EepromData.DemoSettings.RngRequestCount += 5;
mverdy 20:626b92b70bf7 1059 if( Eeprom.EepromData.DemoSettings.RngRequestCount >= DEMO_RNG_CHANNELS_COUNT_MAX )
mverdy 20:626b92b70bf7 1060 {
mverdy 20:626b92b70bf7 1061 Eeprom.EepromData.DemoSettings.RngRequestCount = DEMO_RNG_CHANNELS_COUNT_MIN;
mverdy 20:626b92b70bf7 1062 }
mverdy 20:626b92b70bf7 1063 ButtonChangeText( BTN1_BORDER, NULL, ( uint8_t* )GetRangingRequestCount( ) );
mverdy 20:626b92b70bf7 1064 }
mverdy 20:626b92b70bf7 1065 else if( graphObjectTouched == BTN2_BORDER )
mverdy 20:626b92b70bf7 1066 {
mverdy 20:626b92b70bf7 1067 switch( Eeprom.EepromData.DemoSettings.RngAddress )
mverdy 20:626b92b70bf7 1068 {
mverdy 20:626b92b70bf7 1069 case DEMO_RNG_ADDR_1:
mverdy 20:626b92b70bf7 1070 Eeprom.EepromData.DemoSettings.RngAddress = DEMO_RNG_ADDR_2;
mverdy 20:626b92b70bf7 1071 break;
mverdy 20:626b92b70bf7 1072
mverdy 20:626b92b70bf7 1073 case DEMO_RNG_ADDR_2:
mverdy 20:626b92b70bf7 1074 Eeprom.EepromData.DemoSettings.RngAddress = DEMO_RNG_ADDR_3;
mverdy 20:626b92b70bf7 1075 break;
mverdy 20:626b92b70bf7 1076
mverdy 20:626b92b70bf7 1077 case DEMO_RNG_ADDR_3:
mverdy 20:626b92b70bf7 1078 Eeprom.EepromData.DemoSettings.RngAddress = DEMO_RNG_ADDR_4;
mverdy 20:626b92b70bf7 1079 break;
mverdy 20:626b92b70bf7 1080
mverdy 20:626b92b70bf7 1081 case DEMO_RNG_ADDR_4:
mverdy 20:626b92b70bf7 1082 Eeprom.EepromData.DemoSettings.RngAddress = DEMO_RNG_ADDR_5;
mverdy 20:626b92b70bf7 1083 break;
mverdy 20:626b92b70bf7 1084
mverdy 20:626b92b70bf7 1085 case DEMO_RNG_ADDR_5:
mverdy 20:626b92b70bf7 1086 Eeprom.EepromData.DemoSettings.RngAddress = DEMO_RNG_ADDR_1;
mverdy 20:626b92b70bf7 1087 break;
mverdy 20:626b92b70bf7 1088 }
mverdy 20:626b92b70bf7 1089 ButtonChangeText( BTN2_BORDER, NULL, ( uint8_t* )GetRangingAddress( ) );
mverdy 20:626b92b70bf7 1090 }
mverdy 20:626b92b70bf7 1091 else if( graphObjectTouched == BTN3_BORDER )
mverdy 20:626b92b70bf7 1092 {
mverdy 20:626b92b70bf7 1093 switch( Eeprom.EepromData.DemoSettings.RngAntenna )
mverdy 20:626b92b70bf7 1094 {
mverdy 20:626b92b70bf7 1095 case DEMO_RNG_ANT_1:
mverdy 20:626b92b70bf7 1096 Eeprom.EepromData.DemoSettings.RngAntenna = DEMO_RNG_ANT_0;
mverdy 20:626b92b70bf7 1097 break;
mverdy 20:626b92b70bf7 1098
mverdy 20:626b92b70bf7 1099 case DEMO_RNG_ANT_0:
mverdy 20:626b92b70bf7 1100 Eeprom.EepromData.DemoSettings.RngAntenna = DEMO_RNG_ANT_BOTH;
mverdy 20:626b92b70bf7 1101 break;
mverdy 20:626b92b70bf7 1102
mverdy 20:626b92b70bf7 1103 case DEMO_RNG_ANT_BOTH:
mverdy 20:626b92b70bf7 1104 Eeprom.EepromData.DemoSettings.RngAntenna = DEMO_RNG_ANT_1;
mverdy 20:626b92b70bf7 1105 break;
mverdy 20:626b92b70bf7 1106 }
mverdy 20:626b92b70bf7 1107 ButtonChangeText( BTN3_BORDER, NULL, ( uint8_t* )GetRangingAntenna( ) );
mverdy 20:626b92b70bf7 1108 }
mverdy 20:626b92b70bf7 1109 else if( graphObjectTouched == BTN4_BORDER )
mverdy 20:626b92b70bf7 1110 {
mverdy 20:626b92b70bf7 1111 Eeprom.EepromData.DemoSettings.RngUnit++;
mverdy 20:626b92b70bf7 1112 if( Eeprom.EepromData.DemoSettings.RngUnit > DEMO_RNG_UNIT_SEL_MI )
mverdy 20:626b92b70bf7 1113 {
mverdy 20:626b92b70bf7 1114 Eeprom.EepromData.DemoSettings.RngUnit = DEMO_RNG_UNIT_SEL_M;
mverdy 20:626b92b70bf7 1115 }
mverdy 20:626b92b70bf7 1116 ButtonChangeText( BTN4_BORDER, NULL, ( uint8_t* )GetRangingUnit( ) );
mverdy 20:626b92b70bf7 1117 }
mverdy 20:626b92b70bf7 1118 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1119 {
mverdy 20:626b92b70bf7 1120 EepromMcuReadBuffer( 0, Eeprom.Buffer, EEPROM_BUFFER_SIZE );
mverdy 20:626b92b70bf7 1121 EepromLoadGeneralSettings( );
mverdy 20:626b92b70bf7 1122 EepromLoadSettings( PACKET_TYPE_RANGING );
mverdy 20:626b92b70bf7 1123 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1124 }
mverdy 20:626b92b70bf7 1125 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 1126 {
mverdy 20:626b92b70bf7 1127 EepromSaveSettings( RADIO_RANGING_PARAMS );
mverdy 20:626b92b70bf7 1128 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1129 }
mverdy 20:626b92b70bf7 1130 break;
mverdy 20:626b92b70bf7 1131
mverdy 20:626b92b70bf7 1132 case PAGE_RADIO_PARAM_FREQ:
mverdy 20:626b92b70bf7 1133 if( graphObjectTouched == BTN0_BORDER )
mverdy 20:626b92b70bf7 1134 {
mverdy 20:626b92b70bf7 1135 Eeprom.EepromData.DemoSettings.Frequency -= CurrentFreqBase;
mverdy 20:626b92b70bf7 1136 if( Eeprom.EepromData.DemoSettings.Frequency < DEMO_CENTRAL_FREQ_MIN )
mverdy 20:626b92b70bf7 1137 {
mverdy 20:626b92b70bf7 1138 Eeprom.EepromData.DemoSettings.Frequency = DEMO_CENTRAL_FREQ_MIN;
mverdy 20:626b92b70bf7 1139 }
mverdy 20:626b92b70bf7 1140 ButtonChangeText( BTN2_BORDER, NULL, ( uint8_t* )GetRadioFrequency( ) );
mverdy 20:626b92b70bf7 1141 }
mverdy 20:626b92b70bf7 1142 else if( graphObjectTouched == BTN1_BORDER )
mverdy 20:626b92b70bf7 1143 {
mverdy 20:626b92b70bf7 1144 switch( CurrentFreqBase )
mverdy 20:626b92b70bf7 1145 {
mverdy 20:626b92b70bf7 1146 case FB1:
mverdy 20:626b92b70bf7 1147 CurrentFreqBase = FB10;
mverdy 20:626b92b70bf7 1148 break;
mverdy 20:626b92b70bf7 1149
mverdy 20:626b92b70bf7 1150 case FB10:
mverdy 20:626b92b70bf7 1151 CurrentFreqBase = FB100;
mverdy 20:626b92b70bf7 1152 break;
mverdy 20:626b92b70bf7 1153
mverdy 20:626b92b70bf7 1154 case FB100:
mverdy 20:626b92b70bf7 1155 CurrentFreqBase = FB1K;
mverdy 20:626b92b70bf7 1156 break;
mverdy 20:626b92b70bf7 1157
mverdy 20:626b92b70bf7 1158 case FB1K:
mverdy 20:626b92b70bf7 1159 CurrentFreqBase = FB10K;
mverdy 20:626b92b70bf7 1160 break;
mverdy 20:626b92b70bf7 1161
mverdy 20:626b92b70bf7 1162 case FB10K:
mverdy 20:626b92b70bf7 1163 CurrentFreqBase = FB100K;
mverdy 20:626b92b70bf7 1164 break;
mverdy 20:626b92b70bf7 1165
mverdy 20:626b92b70bf7 1166 case FB100K:
mverdy 20:626b92b70bf7 1167 CurrentFreqBase = FB1M;
mverdy 20:626b92b70bf7 1168 break;
mverdy 20:626b92b70bf7 1169
mverdy 20:626b92b70bf7 1170 case FB1M:
mverdy 20:626b92b70bf7 1171 CurrentFreqBase = FB10M;
mverdy 20:626b92b70bf7 1172 break;
mverdy 20:626b92b70bf7 1173
mverdy 20:626b92b70bf7 1174 case FB10M:
mverdy 20:626b92b70bf7 1175 CurrentFreqBase = FB1;
mverdy 20:626b92b70bf7 1176 break;
mverdy 20:626b92b70bf7 1177 }
mverdy 20:626b92b70bf7 1178 ButtonChangeText( BTN1_BORDER, NULL, ( uint8_t* )GetRadioFreqBase( ) );
mverdy 20:626b92b70bf7 1179 }
mverdy 20:626b92b70bf7 1180 else if( graphObjectTouched == BTN3_BORDER )
mverdy 20:626b92b70bf7 1181 {
mverdy 20:626b92b70bf7 1182 Eeprom.EepromData.DemoSettings.Frequency = DEMO_CENTRAL_FREQ_PRESET1;
mverdy 20:626b92b70bf7 1183 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1184 }
mverdy 20:626b92b70bf7 1185 else if( graphObjectTouched == BTN4_BORDER )
mverdy 20:626b92b70bf7 1186 {
mverdy 20:626b92b70bf7 1187 Eeprom.EepromData.DemoSettings.Frequency = DEMO_CENTRAL_FREQ_PRESET2;
mverdy 20:626b92b70bf7 1188 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1189 }
mverdy 20:626b92b70bf7 1190 else if( graphObjectTouched == BTN5_BORDER )
mverdy 20:626b92b70bf7 1191 {
mverdy 20:626b92b70bf7 1192 Eeprom.EepromData.DemoSettings.Frequency = DEMO_CENTRAL_FREQ_PRESET3;
mverdy 20:626b92b70bf7 1193 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1194 }
mverdy 20:626b92b70bf7 1195 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1196 {
mverdy 20:626b92b70bf7 1197 memcpy( &( Eeprom.EepromData.DemoSettings.Frequency ), Eeprom.Buffer + APP_FREQ_EEPROM_ADDR, 4 );
mverdy 20:626b92b70bf7 1198 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1199 }
mverdy 20:626b92b70bf7 1200 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 1201 {
mverdy 20:626b92b70bf7 1202 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1203 }
mverdy 20:626b92b70bf7 1204 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 1205 {
mverdy 20:626b92b70bf7 1206 Eeprom.EepromData.DemoSettings.Frequency += CurrentFreqBase;
mverdy 20:626b92b70bf7 1207 if( Eeprom.EepromData.DemoSettings.Frequency > DEMO_CENTRAL_FREQ_MAX )
mverdy 20:626b92b70bf7 1208 {
mverdy 20:626b92b70bf7 1209 Eeprom.EepromData.DemoSettings.Frequency = DEMO_CENTRAL_FREQ_MAX;
mverdy 20:626b92b70bf7 1210 }
mverdy 20:626b92b70bf7 1211 ButtonChangeText( BTN2_BORDER, NULL, ( uint8_t* )GetRadioFrequency( ) );
mverdy 20:626b92b70bf7 1212 }
mverdy 20:626b92b70bf7 1213 break;
mverdy 20:626b92b70bf7 1214
mverdy 20:626b92b70bf7 1215 case PAGE_UTILITIES:
mverdy 20:626b92b70bf7 1216 if( graphObjectTouched == BTN0_BORDER )
mverdy 20:626b92b70bf7 1217 {
mverdy 20:626b92b70bf7 1218 FactoryReset( );
mverdy 20:626b92b70bf7 1219 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 1220 }
mverdy 20:626b92b70bf7 1221 else if( graphObjectTouched == BTN4_BORDER )
mverdy 20:626b92b70bf7 1222 {
mverdy 20:626b92b70bf7 1223 if( Eeprom.EepromData.DemoSettings.RadioPowerMode == USE_LDO )
mverdy 20:626b92b70bf7 1224 {
mverdy 20:626b92b70bf7 1225 Eeprom.EepromData.DemoSettings.RadioPowerMode = USE_DCDC;
mverdy 20:626b92b70bf7 1226 }
mverdy 20:626b92b70bf7 1227 else
mverdy 20:626b92b70bf7 1228 {
mverdy 20:626b92b70bf7 1229 Eeprom.EepromData.DemoSettings.RadioPowerMode = USE_LDO;
mverdy 20:626b92b70bf7 1230 }
mverdy 20:626b92b70bf7 1231 ButtonChangeText( BTN4_BORDER, NULL, ( uint8_t* )GetMenuDemoRadioPowerMode( ) );
mverdy 20:626b92b70bf7 1232 }
mverdy 20:626b92b70bf7 1233 else if( graphObjectTouched == BTN5_BORDER )
mverdy 20:626b92b70bf7 1234 {
mverdy 20:626b92b70bf7 1235 switch( Eeprom.EepromData.DemoSettings.MaxNumPacket )
mverdy 20:626b92b70bf7 1236 {
mverdy 20:626b92b70bf7 1237 case 0:
mverdy 20:626b92b70bf7 1238 Eeprom.EepromData.DemoSettings.MaxNumPacket = 100;
mverdy 20:626b92b70bf7 1239 break;
mverdy 20:626b92b70bf7 1240
mverdy 20:626b92b70bf7 1241 case 100:
mverdy 20:626b92b70bf7 1242 Eeprom.EepromData.DemoSettings.MaxNumPacket = 200;
mverdy 20:626b92b70bf7 1243 break;
mverdy 20:626b92b70bf7 1244
mverdy 20:626b92b70bf7 1245 case 200:
mverdy 20:626b92b70bf7 1246 Eeprom.EepromData.DemoSettings.MaxNumPacket = 500;
mverdy 20:626b92b70bf7 1247 break;
mverdy 20:626b92b70bf7 1248
mverdy 20:626b92b70bf7 1249 case 500:
mverdy 20:626b92b70bf7 1250 Eeprom.EepromData.DemoSettings.MaxNumPacket = 1000;
mverdy 20:626b92b70bf7 1251 break;
mverdy 20:626b92b70bf7 1252
mverdy 20:626b92b70bf7 1253 case 1000:
mverdy 20:626b92b70bf7 1254 Eeprom.EepromData.DemoSettings.MaxNumPacket = 0;
mverdy 20:626b92b70bf7 1255 break;
mverdy 20:626b92b70bf7 1256 }
mverdy 20:626b92b70bf7 1257 ButtonChangeText( BTN5_BORDER, NULL, ( uint8_t* )GetMenuDemoMaxNumPacket( ) );
mverdy 20:626b92b70bf7 1258 }
mverdy 20:626b92b70bf7 1259 else if( graphObjectTouched == BTN6_BORDER )
mverdy 20:626b92b70bf7 1260 {
mverdy 20:626b92b70bf7 1261 if( Eeprom.EepromData.DemoSettings.AntennaSwitch == 0 )
mverdy 20:626b92b70bf7 1262 {
mverdy 20:626b92b70bf7 1263 Eeprom.EepromData.DemoSettings.AntennaSwitch = 1;
mverdy 20:626b92b70bf7 1264 ButtonChangeText( BTN6_BORDER, NULL, ( uint8_t* )"ANT0" );
mverdy 20:626b92b70bf7 1265 }
mverdy 20:626b92b70bf7 1266 else
mverdy 20:626b92b70bf7 1267 {
mverdy 20:626b92b70bf7 1268 Eeprom.EepromData.DemoSettings.AntennaSwitch = 0;
mverdy 20:626b92b70bf7 1269 ButtonChangeText( BTN6_BORDER, NULL, ( uint8_t* )"ANT1" );
mverdy 20:626b92b70bf7 1270 }
mverdy 20:626b92b70bf7 1271 }
mverdy 20:626b92b70bf7 1272 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1273 {
mverdy 20:626b92b70bf7 1274 uint8_t modTmp = Eeprom.EepromData.DemoSettings.ModulationType;
mverdy 20:626b92b70bf7 1275
mverdy 20:626b92b70bf7 1276 EepromMcuReadBuffer( 0, Eeprom.Buffer, EEPROM_BUFFER_SIZE );
mverdy 20:626b92b70bf7 1277 EepromLoadGeneralSettings( );
mverdy 20:626b92b70bf7 1278 EepromLoadSettings( ( RadioPacketTypes_t )modTmp );
mverdy 20:626b92b70bf7 1279 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 1280 }
mverdy 20:626b92b70bf7 1281 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 1282 {
mverdy 20:626b92b70bf7 1283 EepromSaveSettings( DEMO_SETTINGS );
mverdy 20:626b92b70bf7 1284 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 1285 }
mverdy 20:626b92b70bf7 1286 else if( refresh == true )
mverdy 20:626b92b70bf7 1287 {
mverdy 20:626b92b70bf7 1288 MenuSetPage( PAGE_UTILITIES );
mverdy 20:626b92b70bf7 1289 }
mverdy 20:626b92b70bf7 1290 break;
mverdy 20:626b92b70bf7 1291
mverdy 20:626b92b70bf7 1292 case PAGE_RADIO_TEST:
mverdy 20:626b92b70bf7 1293 if( graphObjectTouched == BTN1_BORDER )
mverdy 20:626b92b70bf7 1294 {
mverdy 20:626b92b70bf7 1295 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1296 MenuSetPage( PAGE_SLEEP_MODE );
mverdy 20:626b92b70bf7 1297 }
mverdy 20:626b92b70bf7 1298 else if( graphObjectTouched == BTN2_BORDER )
mverdy 20:626b92b70bf7 1299 {
mverdy 20:626b92b70bf7 1300 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1301 MenuSetPage( PAGE_STBY_RC_MODE );
mverdy 20:626b92b70bf7 1302 }
mverdy 20:626b92b70bf7 1303 else if( graphObjectTouched == BTN3_BORDER )
mverdy 20:626b92b70bf7 1304 {
mverdy 20:626b92b70bf7 1305 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1306 MenuSetPage( PAGE_STBY_XOSC_MODE );
mverdy 20:626b92b70bf7 1307 }
mverdy 20:626b92b70bf7 1308 else if( graphObjectTouched == BTN4_BORDER )
mverdy 20:626b92b70bf7 1309 {
mverdy 20:626b92b70bf7 1310 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1311 MenuSetPage( PAGE_TX_CW );
mverdy 20:626b92b70bf7 1312 }
mverdy 20:626b92b70bf7 1313 else if( graphObjectTouched == BTN5_BORDER )
mverdy 20:626b92b70bf7 1314 {
mverdy 20:626b92b70bf7 1315 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1316 MenuSetPage( PAGE_CONT_MODULATION );
mverdy 20:626b92b70bf7 1317 }
mverdy 20:626b92b70bf7 1318 else if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1319 {
mverdy 20:626b92b70bf7 1320 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1321 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 1322 }
mverdy 20:626b92b70bf7 1323 break;
mverdy 20:626b92b70bf7 1324
mverdy 20:626b92b70bf7 1325 case PAGE_SLEEP_MODE:
mverdy 20:626b92b70bf7 1326 if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1327 {
mverdy 20:626b92b70bf7 1328 StopDemoApplication( );
mverdy 20:626b92b70bf7 1329 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1330 PreviousPage = START_PAGE; // clear Previous page
mverdy 20:626b92b70bf7 1331 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 1332 }
mverdy 20:626b92b70bf7 1333 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 1334 {
mverdy 20:626b92b70bf7 1335 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 1336 {
mverdy 20:626b92b70bf7 1337 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 1338 StopDemoApplication( );
mverdy 20:626b92b70bf7 1339 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" STOP", NULL );
mverdy 20:626b92b70bf7 1340 RunDemoSleepMode( );
mverdy 20:626b92b70bf7 1341 }
mverdy 20:626b92b70bf7 1342 else
mverdy 20:626b92b70bf7 1343 {
mverdy 20:626b92b70bf7 1344 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1345 StopDemoApplication( );
mverdy 20:626b92b70bf7 1346 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1347 MenuSetPage( PAGE_SLEEP_MODE );
mverdy 20:626b92b70bf7 1348 }
mverdy 20:626b92b70bf7 1349 }
mverdy 20:626b92b70bf7 1350 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 1351 {
mverdy 20:626b92b70bf7 1352 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1353 // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
mverdy 20:626b92b70bf7 1354 // PreviousPage to set next page. Speed up the navigation.
mverdy 20:626b92b70bf7 1355 PreviousPage = PAGE_SLEEP_MODE;
mverdy 20:626b92b70bf7 1356 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1357 }
mverdy 20:626b92b70bf7 1358 break;
mverdy 20:626b92b70bf7 1359
mverdy 20:626b92b70bf7 1360 case PAGE_STBY_RC_MODE:
mverdy 20:626b92b70bf7 1361 if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1362 {
mverdy 20:626b92b70bf7 1363 StopDemoApplication( );
mverdy 20:626b92b70bf7 1364 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1365 PreviousPage = START_PAGE; // clear Previous page
mverdy 20:626b92b70bf7 1366 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 1367 }
mverdy 20:626b92b70bf7 1368 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 1369 {
mverdy 20:626b92b70bf7 1370 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 1371 {
mverdy 20:626b92b70bf7 1372 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 1373 StopDemoApplication( );
mverdy 20:626b92b70bf7 1374 RunDemoStandbyRcMode( );
mverdy 20:626b92b70bf7 1375 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" STOP", NULL );
mverdy 20:626b92b70bf7 1376 }
mverdy 20:626b92b70bf7 1377 else
mverdy 20:626b92b70bf7 1378 {
mverdy 20:626b92b70bf7 1379 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1380 StopDemoApplication( );
mverdy 20:626b92b70bf7 1381 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1382 }
mverdy 20:626b92b70bf7 1383 }
mverdy 20:626b92b70bf7 1384 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 1385 {
mverdy 20:626b92b70bf7 1386 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1387 // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
mverdy 20:626b92b70bf7 1388 // PreviousPage to set next page. Speed up the navigation.
mverdy 20:626b92b70bf7 1389 PreviousPage = PAGE_STBY_RC_MODE;
mverdy 20:626b92b70bf7 1390 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1391 }
mverdy 20:626b92b70bf7 1392 break;
mverdy 20:626b92b70bf7 1393
mverdy 20:626b92b70bf7 1394 case PAGE_STBY_XOSC_MODE:
mverdy 20:626b92b70bf7 1395 if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1396 {
mverdy 20:626b92b70bf7 1397 StopDemoApplication( );
mverdy 20:626b92b70bf7 1398 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1399 PreviousPage = START_PAGE; // clear Previous page
mverdy 20:626b92b70bf7 1400 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 1401 }
mverdy 20:626b92b70bf7 1402 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 1403 {
mverdy 20:626b92b70bf7 1404 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 1405 {
mverdy 20:626b92b70bf7 1406 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 1407 StopDemoApplication( );
mverdy 20:626b92b70bf7 1408 RunDemoStandbyXoscMode( );
mverdy 20:626b92b70bf7 1409 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" STOP", NULL );
mverdy 20:626b92b70bf7 1410 }
mverdy 20:626b92b70bf7 1411 else
mverdy 20:626b92b70bf7 1412 {
mverdy 20:626b92b70bf7 1413 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1414 StopDemoApplication( );
mverdy 20:626b92b70bf7 1415 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1416 }
mverdy 20:626b92b70bf7 1417 }
mverdy 20:626b92b70bf7 1418 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 1419 {
mverdy 20:626b92b70bf7 1420 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1421 // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
mverdy 20:626b92b70bf7 1422 // PreviousPage to set next page. Speed up the navigation.
mverdy 20:626b92b70bf7 1423 PreviousPage = PAGE_STBY_XOSC_MODE;
mverdy 20:626b92b70bf7 1424 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1425 }
mverdy 20:626b92b70bf7 1426 break;
mverdy 20:626b92b70bf7 1427
mverdy 20:626b92b70bf7 1428 case PAGE_TX_CW:
mverdy 20:626b92b70bf7 1429 if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1430 {
mverdy 20:626b92b70bf7 1431 StopDemoApplication( );
mverdy 20:626b92b70bf7 1432 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1433 PreviousPage = START_PAGE; // clear Previous page
mverdy 20:626b92b70bf7 1434 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 1435 }
mverdy 20:626b92b70bf7 1436 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 1437 {
mverdy 20:626b92b70bf7 1438 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 1439 {
mverdy 20:626b92b70bf7 1440 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 1441 StopDemoApplication( );
mverdy 20:626b92b70bf7 1442 RunDemoTxCw( );
mverdy 20:626b92b70bf7 1443 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" STOP", NULL );
mverdy 20:626b92b70bf7 1444 }
mverdy 20:626b92b70bf7 1445 else
mverdy 20:626b92b70bf7 1446 {
mverdy 20:626b92b70bf7 1447 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1448 StopDemoApplication( );
mverdy 20:626b92b70bf7 1449 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1450 }
mverdy 20:626b92b70bf7 1451 }
mverdy 20:626b92b70bf7 1452 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 1453 {
mverdy 20:626b92b70bf7 1454 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1455 // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
mverdy 20:626b92b70bf7 1456 // PreviousPage to set next page. Speed up the navigation.
mverdy 20:626b92b70bf7 1457 PreviousPage = PAGE_TX_CW;
mverdy 20:626b92b70bf7 1458 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1459 }
mverdy 20:626b92b70bf7 1460 break;
mverdy 20:626b92b70bf7 1461
mverdy 20:626b92b70bf7 1462 case PAGE_CONT_MODULATION:
mverdy 20:626b92b70bf7 1463 if( graphObjectTouched == BTN7_BORDER )
mverdy 20:626b92b70bf7 1464 {
mverdy 20:626b92b70bf7 1465 StopDemoApplication( );
mverdy 20:626b92b70bf7 1466 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1467 PreviousPage = START_PAGE; // clear Previous page
mverdy 20:626b92b70bf7 1468 MenuSetPage( START_PAGE );
mverdy 20:626b92b70bf7 1469 }
mverdy 20:626b92b70bf7 1470 else if( graphObjectTouched == BTN8_BORDER )
mverdy 20:626b92b70bf7 1471 {
mverdy 20:626b92b70bf7 1472 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 1473 {
mverdy 20:626b92b70bf7 1474 Eeprom.EepromData.DemoSettings.HoldDemo = false;
mverdy 20:626b92b70bf7 1475 StopDemoApplication( );
mverdy 20:626b92b70bf7 1476 RunDemoTxContinuousModulation( );
mverdy 20:626b92b70bf7 1477 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" STOP", NULL );
mverdy 20:626b92b70bf7 1478 }
mverdy 20:626b92b70bf7 1479 else
mverdy 20:626b92b70bf7 1480 {
mverdy 20:626b92b70bf7 1481 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1482 StopDemoApplication( );
mverdy 20:626b92b70bf7 1483 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1484 }
mverdy 20:626b92b70bf7 1485 }
mverdy 20:626b92b70bf7 1486 else if( graphObjectTouched == BTN9_BORDER )
mverdy 20:626b92b70bf7 1487 {
mverdy 20:626b92b70bf7 1488 Eeprom.EepromData.DemoSettings.HoldDemo = true;
mverdy 20:626b92b70bf7 1489 // "CANCEL" or "OK & SAVE" button of PAGE_RADIO_PARAM use
mverdy 20:626b92b70bf7 1490 // PreviousPage to set next page. Speed up the navigation.
mverdy 20:626b92b70bf7 1491 PreviousPage = PAGE_CONT_MODULATION;
mverdy 20:626b92b70bf7 1492 MenuSetPage( PAGE_RADIO_PARAM );
mverdy 20:626b92b70bf7 1493 }
mverdy 20:626b92b70bf7 1494 break;
mverdy 20:626b92b70bf7 1495 }
mverdy 20:626b92b70bf7 1496 }
mverdy 20:626b92b70bf7 1497 return CurrentPage;
mverdy 20:626b92b70bf7 1498 }
lex9296 21:ab8027016a2c 1499 */
mverdy 20:626b92b70bf7 1500
lex9296 21:ab8027016a2c 1501 /*
mverdy 20:626b92b70bf7 1502 void MenuSetPage( uint8_t page )
mverdy 20:626b92b70bf7 1503 {
mverdy 20:626b92b70bf7 1504 if( page != CurrentPage )
mverdy 20:626b92b70bf7 1505 {
mverdy 20:626b92b70bf7 1506 // remove all button and text (except title, page border and line)
mverdy 20:626b92b70bf7 1507 // and disable all button (touchActive = false).
mverdy 20:626b92b70bf7 1508 GraphObject_t clearRect = { NULL, GO_RECTANGLE, 3, 35, 282, 230, 1, \
mverdy 20:626b92b70bf7 1509 BACK_COLOR, BACK_COLOR, true, BACK_COLOR, \
mverdy 20:626b92b70bf7 1510 NULL, false };
mverdy 20:626b92b70bf7 1511
mverdy 20:626b92b70bf7 1512 GraphObjectClear( &clearRect, true );
mverdy 20:626b92b70bf7 1513 for( uint8_t i = 0; i < GRAPH_OBJECTS_COUNT; i++ )
mverdy 20:626b92b70bf7 1514 {
mverdy 20:626b92b70bf7 1515 MenuObjects[i].TouchActive = false;
mverdy 20:626b92b70bf7 1516 }
mverdy 20:626b92b70bf7 1517 }
mverdy 20:626b92b70bf7 1518
mverdy 20:626b92b70bf7 1519 switch( page )
mverdy 20:626b92b70bf7 1520 {
mverdy 20:626b92b70bf7 1521 case START_PAGE:
mverdy 20:626b92b70bf7 1522 DrawText( TITLE_TEXT, ( uint8_t* )" SX1280 Demo Kit", NULL, NULL );
mverdy 20:626b92b70bf7 1523 DisplayDriverDrawLogo( SemtechLogo, 20, 37 );
mverdy 20:626b92b70bf7 1524 DrawActiveButton( BTN2_BORDER, ( uint8_t* )"DEMO Ping Pong", NULL );
mverdy 20:626b92b70bf7 1525 DrawActiveButton( BTN3_BORDER, ( uint8_t* )"DEMO PER FHSS", NULL );
mverdy 20:626b92b70bf7 1526 DrawActiveButton( BTN4_BORDER, ( uint8_t* )"Outdoor ranging demo", NULL );
mverdy 20:626b92b70bf7 1527 DrawActiveButton( BTN5_BORDER, ( uint8_t* )"Radio Test Modes", NULL );
mverdy 20:626b92b70bf7 1528 DrawActiveButton( BTN6_BORDER, ( uint8_t* )"Radio Settings", NULL );
mverdy 20:626b92b70bf7 1529 DrawActiveButton( BTN7_BORDER, ( uint8_t* )"Utilities", NULL );
mverdy 20:626b92b70bf7 1530 CurrentPage = START_PAGE;
mverdy 20:626b92b70bf7 1531 break;
mverdy 20:626b92b70bf7 1532
mverdy 20:626b92b70bf7 1533 case PAGE_PING_PONG:
mverdy 20:626b92b70bf7 1534 if( CurrentPage == PAGE_PING_PONG )
mverdy 20:626b92b70bf7 1535 {
mverdy 20:626b92b70bf7 1536 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 1537 {
mverdy 20:626b92b70bf7 1538 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1539 }
mverdy 20:626b92b70bf7 1540 if( Eeprom.EepromData.DemoSettings.Entity == MASTER )
mverdy 20:626b92b70bf7 1541 {
mverdy 20:626b92b70bf7 1542 DrawText( LINE4_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoRxOkSlave( ), ( uint8_t* )GetMenuDemoRxOk( ) );
mverdy 20:626b92b70bf7 1543 DrawText( LINE5_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoRxKoSlave( ), ( uint8_t* )GetMenuDemoRxKo( ) );
mverdy 20:626b92b70bf7 1544 DrawText( LINE6_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoResultPerCent1( Eeprom.EepromData.DemoSettings.CntPacketRxOKSlave, Eeprom.EepromData.DemoSettings.CntPacketRxOKSlave + Eeprom.EepromData.DemoSettings.CntPacketRxKOSlave ), \
mverdy 20:626b92b70bf7 1545 ( uint8_t* )GetMenuDemoResultPerCent2( Eeprom.EepromData.DemoSettings.CntPacketRxOK, Eeprom.EepromData.DemoSettings.CntPacketRxOK + Eeprom.EepromData.DemoSettings.CntPacketRxKO + Eeprom.EepromData.DemoSettings.RxTimeOutCount ) );
mverdy 20:626b92b70bf7 1546 DrawText( LINE7_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoResultPerCent1( Eeprom.EepromData.DemoSettings.CntPacketRxKOSlave, Eeprom.EepromData.DemoSettings.CntPacketRxOKSlave + Eeprom.EepromData.DemoSettings.CntPacketRxKOSlave ), \
mverdy 20:626b92b70bf7 1547 ( uint8_t* )GetMenuDemoResultPerCent2( Eeprom.EepromData.DemoSettings.CntPacketRxKO + Eeprom.EepromData.DemoSettings.RxTimeOutCount, Eeprom.EepromData.DemoSettings.CntPacketRxOK + Eeprom.EepromData.DemoSettings.CntPacketRxKO + Eeprom.EepromData.DemoSettings.RxTimeOutCount ) );
mverdy 20:626b92b70bf7 1548 DrawText( LINE8_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoRssi( ), NULL );
mverdy 20:626b92b70bf7 1549 DrawText( LINE9_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoSnr( ), NULL );
mverdy 20:626b92b70bf7 1550 }
mverdy 20:626b92b70bf7 1551 else
mverdy 20:626b92b70bf7 1552 {
mverdy 20:626b92b70bf7 1553 DrawText( LINE4_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoRxOk( ), NULL );
mverdy 20:626b92b70bf7 1554 DrawText( LINE5_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoRxKo( ), NULL );
mverdy 20:626b92b70bf7 1555 DrawText( LINE6_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoResultPerCent1( Eeprom.EepromData.DemoSettings.CntPacketRxOK, Eeprom.EepromData.DemoSettings.CntPacketRxOK + Eeprom.EepromData.DemoSettings.CntPacketRxKO + Eeprom.EepromData.DemoSettings.RxTimeOutCount ), NULL );
mverdy 20:626b92b70bf7 1556 DrawText( LINE7_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoResultPerCent1( Eeprom.EepromData.DemoSettings.CntPacketRxKO + Eeprom.EepromData.DemoSettings.RxTimeOutCount, Eeprom.EepromData.DemoSettings.CntPacketRxOK + Eeprom.EepromData.DemoSettings.CntPacketRxKO + Eeprom.EepromData.DemoSettings.RxTimeOutCount ), NULL );
mverdy 20:626b92b70bf7 1557 DrawText( LINE8_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoRssi( ), NULL );
mverdy 20:626b92b70bf7 1558 DrawText( LINE9_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoSnr( ), NULL );
mverdy 20:626b92b70bf7 1559 }
mverdy 20:626b92b70bf7 1560 }
mverdy 20:626b92b70bf7 1561 else
mverdy 20:626b92b70bf7 1562 {
mverdy 20:626b92b70bf7 1563 DrawText( TITLE_TEXT, ( uint8_t* )" PING PONG Demo", NULL, NULL );
mverdy 20:626b92b70bf7 1564 DisplayCurrentRadioParams( PAGE_PING_PONG );
mverdy 20:626b92b70bf7 1565 DrawText( LINE3_COL0_TEXT, ( uint8_t* )GetTotalPackets( ), ( uint8_t* )" SLAVE", NULL );
mverdy 20:626b92b70bf7 1566 DrawText( LINE4_COL0_TEXT, ( uint8_t* )"Rx OK", ( uint8_t* )" 0", NULL );
mverdy 20:626b92b70bf7 1567 DrawText( LINE5_COL0_TEXT, ( uint8_t* )"Rx KO", ( uint8_t* )" 0", NULL );
mverdy 20:626b92b70bf7 1568 DrawText( LINE6_COL0_TEXT, ( uint8_t* )"Rx PSR", ( uint8_t* )" 0.00", NULL );
mverdy 20:626b92b70bf7 1569 DrawText( LINE7_COL0_TEXT, ( uint8_t* )"Rx PER", ( uint8_t* )" 0.00", NULL );
mverdy 20:626b92b70bf7 1570 DrawText( LINE8_COL0_TEXT, ( uint8_t* )"Last Rssi", ( uint8_t* )" 0", NULL );
mverdy 20:626b92b70bf7 1571 DrawText( LINE9_COL0_TEXT, ( uint8_t* )"Last SNR", ( uint8_t* )" 0", NULL );
mverdy 20:626b92b70bf7 1572 if( Eeprom.EepromData.DemoSettings.Entity == MASTER )
mverdy 20:626b92b70bf7 1573 {
mverdy 20:626b92b70bf7 1574 DrawActiveButton( BTN0_BORDER, ( uint8_t* )" MASTER", NULL );
mverdy 20:626b92b70bf7 1575 DrawText( LINE3_COL0_TEXT, NULL, NULL, ( uint8_t* )"MASTER" );
mverdy 20:626b92b70bf7 1576 DrawText( LINE4_COL0_TEXT, NULL, NULL, ( uint8_t* )" 0" );
mverdy 20:626b92b70bf7 1577 DrawText( LINE5_COL0_TEXT, NULL, NULL, ( uint8_t* )" 0" );
mverdy 20:626b92b70bf7 1578 DrawText( LINE6_COL0_TEXT, NULL, NULL, ( uint8_t* )" 0.00" );
mverdy 20:626b92b70bf7 1579 DrawText( LINE7_COL0_TEXT, NULL, NULL, ( uint8_t* )" 0.00" );
mverdy 20:626b92b70bf7 1580 }
mverdy 20:626b92b70bf7 1581 else
mverdy 20:626b92b70bf7 1582 {
mverdy 20:626b92b70bf7 1583 DrawActiveButton( BTN0_BORDER, ( uint8_t* )" SLAVE", NULL );
mverdy 20:626b92b70bf7 1584 }
mverdy 20:626b92b70bf7 1585 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" EXIT", NULL );
mverdy 20:626b92b70bf7 1586 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1587 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" SETTINGS", NULL );
mverdy 20:626b92b70bf7 1588 }
mverdy 20:626b92b70bf7 1589 CurrentPage = PAGE_PING_PONG;
mverdy 20:626b92b70bf7 1590 break;
mverdy 20:626b92b70bf7 1591
mverdy 20:626b92b70bf7 1592 case PAGE_PER:
mverdy 20:626b92b70bf7 1593 if( CurrentPage == PAGE_PER )
mverdy 20:626b92b70bf7 1594 {
mverdy 20:626b92b70bf7 1595 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 1596 {
mverdy 20:626b92b70bf7 1597 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1598 }
mverdy 20:626b92b70bf7 1599 if( Eeprom.EepromData.DemoSettings.Entity == MASTER )
mverdy 20:626b92b70bf7 1600 {
mverdy 20:626b92b70bf7 1601 DrawText( LINE4_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoNumSentPacket( ), NULL );
mverdy 20:626b92b70bf7 1602 }
mverdy 20:626b92b70bf7 1603 else
mverdy 20:626b92b70bf7 1604 {
mverdy 20:626b92b70bf7 1605 DrawText( LINE4_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoRxOk( ), NULL );
mverdy 20:626b92b70bf7 1606 DrawText( LINE5_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoRxKo( ), NULL );
mverdy 20:626b92b70bf7 1607 DrawText( LINE6_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoResultPerCent1( Eeprom.EepromData.DemoSettings.CntPacketRxKO + Eeprom.EepromData.DemoSettings.RxTimeOutCount, Eeprom.EepromData.DemoSettings.CntPacketRxOK + Eeprom.EepromData.DemoSettings.CntPacketRxKO + Eeprom.EepromData.DemoSettings.RxTimeOutCount ), NULL );
mverdy 20:626b92b70bf7 1608 DrawText( LINE8_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoRssi( ), NULL );
mverdy 20:626b92b70bf7 1609 DrawText( LINE9_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoSnr( ), NULL );
mverdy 20:626b92b70bf7 1610 }
mverdy 20:626b92b70bf7 1611 }
mverdy 20:626b92b70bf7 1612 else
mverdy 20:626b92b70bf7 1613 {
mverdy 20:626b92b70bf7 1614 DrawText( TITLE_TEXT, ( uint8_t* )" PER Demo FHSS", NULL, NULL );
mverdy 20:626b92b70bf7 1615 DrawText( LINE3_COL0_TEXT, ( uint8_t* )"Test Total", ( uint8_t* )GetMenuDemoMaxNumPacket( ), NULL );
mverdy 20:626b92b70bf7 1616 DisplayCurrentRadioParams( PAGE_PER );
mverdy 20:626b92b70bf7 1617 if( Eeprom.EepromData.DemoSettings.Entity == MASTER )
mverdy 20:626b92b70bf7 1618 {
mverdy 20:626b92b70bf7 1619 DrawActiveButton( BTN0_BORDER, ( uint8_t* )" MASTER", NULL );
mverdy 20:626b92b70bf7 1620 DrawText( LINE4_COL0_TEXT, ( uint8_t* )"Transmitted", ( uint8_t* )GetMenuDemoNumSentPacket( ), NULL );
mverdy 20:626b92b70bf7 1621 }
mverdy 20:626b92b70bf7 1622 else
mverdy 20:626b92b70bf7 1623 {
mverdy 20:626b92b70bf7 1624 DrawActiveButton( BTN0_BORDER, ( uint8_t* )" SLAVE", NULL );
mverdy 20:626b92b70bf7 1625 DrawText( LINE4_COL0_TEXT, ( uint8_t* )"Rx OK", ( uint8_t* )" 0", NULL );
mverdy 20:626b92b70bf7 1626 DrawText( LINE5_COL0_TEXT, ( uint8_t* )"Rx KO", ( uint8_t* )" 0", NULL );
mverdy 20:626b92b70bf7 1627 DrawText( LINE6_COL0_TEXT, ( uint8_t* )"PER", ( uint8_t* )" 0.00", NULL );
mverdy 20:626b92b70bf7 1628 DrawText( LINE8_COL0_TEXT, ( uint8_t* )"Last Rssi", ( uint8_t* )" 0", NULL );
mverdy 20:626b92b70bf7 1629 DrawText( LINE9_COL0_TEXT, ( uint8_t* )"Last SNR", ( uint8_t* )" 0", NULL );
mverdy 20:626b92b70bf7 1630 }
mverdy 20:626b92b70bf7 1631 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" EXIT", NULL );
mverdy 20:626b92b70bf7 1632 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1633 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" SETTINGS", NULL );
mverdy 20:626b92b70bf7 1634 }
mverdy 20:626b92b70bf7 1635 CurrentPage = PAGE_PER;
mverdy 20:626b92b70bf7 1636 break;
mverdy 20:626b92b70bf7 1637
mverdy 20:626b92b70bf7 1638 case PAGE_RANGING_MASTER:
mverdy 20:626b92b70bf7 1639 if( CurrentPage == PAGE_RANGING_MASTER )
mverdy 20:626b92b70bf7 1640 {
mverdy 20:626b92b70bf7 1641 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 1642 {
mverdy 20:626b92b70bf7 1643 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" REFRESH", NULL );
mverdy 20:626b92b70bf7 1644 }
mverdy 20:626b92b70bf7 1645 // Clear actual distance token
mverdy 20:626b92b70bf7 1646 GraphObjectClear( &( MenuObjects[RNG_DIST_CIRCLE] ), true );
mverdy 20:626b92b70bf7 1647 // update scale of circles
mverdy 20:626b92b70bf7 1648 for( uint8_t i = SCALE_LINE_COUNT; i > 0; i-- )
mverdy 20:626b92b70bf7 1649 {
mverdy 20:626b92b70bf7 1650 sprintf( StringText, "%d", i * ( Eeprom.EepromData.DemoSettings.RngFullScale / SCALE_LINE_COUNT ) );
mverdy 20:626b92b70bf7 1651 DrawText( RNG_DS1_TEXT + i - 1, ( uint8_t* )" ", NULL, NULL );
mverdy 20:626b92b70bf7 1652 DrawText( RNG_DS1_TEXT + i - 1, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 1653 }
mverdy 20:626b92b70bf7 1654 uint16_t DistPixel;
mverdy 20:626b92b70bf7 1655 // Compute position (pixel) of token
mverdy 20:626b92b70bf7 1656 // distance line high is 160px : it's the reference for distance graphical objects (represent full scale)
mverdy 20:626b92b70bf7 1657 DistPixel = ( uint16_t )( Eeprom.EepromData.DemoSettings.RngDistance * 160.0 / Eeprom.EepromData.DemoSettings.RngFullScale );
mverdy 20:626b92b70bf7 1658 MenuObjects[RNG_DIST_CIRCLE].FrontColor = WHITE;
mverdy 20:626b92b70bf7 1659 // Need to change full scale ? yes if dist > fullscale or if dist < fullscale / SCALE_LINE_COUNT
mverdy 20:626b92b70bf7 1660 // fullscale will be updated next time
mverdy 20:626b92b70bf7 1661 if( DistPixel > 160 )
mverdy 20:626b92b70bf7 1662 {
mverdy 20:626b92b70bf7 1663 DistPixel = 160;
mverdy 20:626b92b70bf7 1664 MenuObjects[RNG_DIST_CIRCLE].FrontColor = OBJECT_ERROR;
mverdy 20:626b92b70bf7 1665 Eeprom.EepromData.DemoSettings.RngFullScale = ( uint16_t )ceil( 1.2 * ( Eeprom.EepromData.DemoSettings.RngDistance / SCALE_LINE_COUNT ) ) * SCALE_LINE_COUNT;
mverdy 20:626b92b70bf7 1666 if( Eeprom.EepromData.DemoSettings.RngFullScale > RANGING_FULLSCALE_MAX )
mverdy 20:626b92b70bf7 1667 {
mverdy 20:626b92b70bf7 1668 Eeprom.EepromData.DemoSettings.RngFullScale = RANGING_FULLSCALE_MAX;
mverdy 20:626b92b70bf7 1669 }
mverdy 20:626b92b70bf7 1670 }
mverdy 20:626b92b70bf7 1671 else if( DistPixel < ( 160 / SCALE_LINE_COUNT ) )
mverdy 20:626b92b70bf7 1672 {
mverdy 20:626b92b70bf7 1673 Eeprom.EepromData.DemoSettings.RngFullScale = ( uint16_t )ceil( 1.2 * ( Eeprom.EepromData.DemoSettings.RngDistance / SCALE_LINE_COUNT ) ) * SCALE_LINE_COUNT;
mverdy 20:626b92b70bf7 1674 if( Eeprom.EepromData.DemoSettings.RngFullScale < RANGING_FULLSCALE_MIN )
mverdy 20:626b92b70bf7 1675 {
mverdy 20:626b92b70bf7 1676 Eeprom.EepromData.DemoSettings.RngFullScale = RANGING_FULLSCALE_MIN;
mverdy 20:626b92b70bf7 1677 }
mverdy 20:626b92b70bf7 1678 }
mverdy 20:626b92b70bf7 1679 // Check timeout error
mverdy 20:626b92b70bf7 1680 if( Eeprom.EepromData.DemoSettings.RngStatus != RNG_VALID )
mverdy 20:626b92b70bf7 1681 {
mverdy 20:626b92b70bf7 1682 MenuObjects[RNG_DIST_CIRCLE].FrontColor = OBJECT_ERROR;
mverdy 20:626b92b70bf7 1683 }
mverdy 20:626b92b70bf7 1684 switch( Eeprom.EepromData.DemoSettings.RngUnit )
mverdy 20:626b92b70bf7 1685 {
mverdy 20:626b92b70bf7 1686 case DEMO_RNG_UNIT_SEL_M:
mverdy 20:626b92b70bf7 1687 // Print distance on the top with decimal under 1000
mverdy 20:626b92b70bf7 1688 if( Eeprom.EepromData.DemoSettings.RngDistance >= 1000.0 )
mverdy 20:626b92b70bf7 1689 {
mverdy 20:626b92b70bf7 1690 sprintf( StringText, "Range: %5d m", ( uint16_t )Eeprom.EepromData.DemoSettings.RngDistance );
mverdy 20:626b92b70bf7 1691 sprintf( StringText2, "%6d", ( uint16_t )Eeprom.EepromData.DemoSettings.RngRawDistance );
mverdy 20:626b92b70bf7 1692 }
mverdy 20:626b92b70bf7 1693 else
mverdy 20:626b92b70bf7 1694 {
mverdy 20:626b92b70bf7 1695 sprintf( StringText, "Range: %5.1f m", Eeprom.EepromData.DemoSettings.RngDistance );
mverdy 20:626b92b70bf7 1696 sprintf( StringText2, "%6.1f", Eeprom.EepromData.DemoSettings.RngRawDistance );
mverdy 20:626b92b70bf7 1697 }
mverdy 20:626b92b70bf7 1698 break;
mverdy 20:626b92b70bf7 1699
mverdy 20:626b92b70bf7 1700 case DEMO_RNG_UNIT_SEL_YD:
mverdy 20:626b92b70bf7 1701 // Print distance on the top with decimal under 1000
mverdy 20:626b92b70bf7 1702 if( Eeprom.EepromData.DemoSettings.RngDistance >= 1000.0 )
mverdy 20:626b92b70bf7 1703 {
mverdy 20:626b92b70bf7 1704 sprintf( StringText, "Range: %5d yd", ( uint16_t )Eeprom.EepromData.DemoSettings.RngDistance );
mverdy 20:626b92b70bf7 1705 sprintf( StringText2, "%6d", ( uint16_t )Eeprom.EepromData.DemoSettings.RngRawDistance );
mverdy 20:626b92b70bf7 1706 }
mverdy 20:626b92b70bf7 1707 else
mverdy 20:626b92b70bf7 1708 {
mverdy 20:626b92b70bf7 1709 sprintf( StringText, "Range: %5.1f yd", Eeprom.EepromData.DemoSettings.RngDistance );
mverdy 20:626b92b70bf7 1710 sprintf( StringText2, "%6.1f", Eeprom.EepromData.DemoSettings.RngRawDistance );
mverdy 20:626b92b70bf7 1711 }
mverdy 20:626b92b70bf7 1712 break;
mverdy 20:626b92b70bf7 1713
mverdy 20:626b92b70bf7 1714 case DEMO_RNG_UNIT_SEL_MI:
mverdy 20:626b92b70bf7 1715 sprintf( StringText, "Range: %5.2f mi", Eeprom.EepromData.DemoSettings.RngDistance );
mverdy 20:626b92b70bf7 1716 sprintf( StringText2, "%6.1f", Eeprom.EepromData.DemoSettings.RngRawDistance );
mverdy 20:626b92b70bf7 1717 break;
mverdy 20:626b92b70bf7 1718 }
mverdy 20:626b92b70bf7 1719 DrawText( RNG_DIST_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 1720 DrawText( LINE5_COL0_TEXT, NULL, ( uint8_t* )StringText2, NULL );
mverdy 20:626b92b70bf7 1721 DrawText( LINE6_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoNumSentPacket( ), NULL );
mverdy 20:626b92b70bf7 1722 DrawText( LINE7_COL0_TEXT, NULL, ( uint8_t* )GetFrequencyError( ), NULL );
mverdy 20:626b92b70bf7 1723 DrawText( LINE8_COL0_TEXT, NULL, ( uint8_t* )GetRngChannelsOk( ), NULL );
mverdy 20:626b92b70bf7 1724 sprintf( StringText, "%6d", Eeprom.EepromData.DemoSettings.CntPacketRxOKSlave );
mverdy 20:626b92b70bf7 1725 DrawText( LINE9_COL0_TEXT, NULL, ( uint8_t* )StringText, NULL );
mverdy 20:626b92b70bf7 1726
mverdy 20:626b92b70bf7 1727 // Draw token at its new position. 270 is the absolute px position (y) of distance 0
mverdy 20:626b92b70bf7 1728 MenuObjects[RNG_DIST_CIRCLE].Ypos = 270 - DistPixel;
mverdy 20:626b92b70bf7 1729 GraphObjectDraw( &( MenuObjects[RNG_DIST_CIRCLE] ), NULL, true, false );
mverdy 20:626b92b70bf7 1730 }
mverdy 20:626b92b70bf7 1731 else
mverdy 20:626b92b70bf7 1732 {
mverdy 20:626b92b70bf7 1733 GraphObject_t clearRect = { NULL, GO_RECTANGLE, 1, 284, 35, 238, \
mverdy 20:626b92b70bf7 1734 1, BACK_COLOR, BACK_COLOR, true, \
mverdy 20:626b92b70bf7 1735 BACK_COLOR, NULL, false };
mverdy 20:626b92b70bf7 1736
mverdy 20:626b92b70bf7 1737 DrawText( TITLE_TEXT, ( uint8_t* )" Outdoor ranging demo", NULL, NULL );
mverdy 20:626b92b70bf7 1738 DrawActiveButton( BTN0_BORDER, ( uint8_t* )" MASTER", NULL );
mverdy 20:626b92b70bf7 1739 DisplayCurrentRadioParams( PAGE_RANGING_MASTER );
mverdy 20:626b92b70bf7 1740 // Draw lines
mverdy 20:626b92b70bf7 1741 GraphObjectDraw( &( MenuObjects[RNG_DS0_LINE] ), NULL, true, false );
mverdy 20:626b92b70bf7 1742 for( uint8_t i = RNG_DS1_LINE; i <= RNG_DS5_LINE; i++ )
mverdy 20:626b92b70bf7 1743 {
mverdy 20:626b92b70bf7 1744 GraphObjectDraw( &( MenuObjects[i] ), NULL, true, false );
mverdy 20:626b92b70bf7 1745 }
mverdy 20:626b92b70bf7 1746 // Draw around scale of distance
mverdy 20:626b92b70bf7 1747 for( uint8_t i = SCALE_LINE_COUNT; i > 0; i-- )
mverdy 20:626b92b70bf7 1748 {
mverdy 20:626b92b70bf7 1749 sprintf( StringText, "%d", i * ( Eeprom.EepromData.DemoSettings.RngFullScale / SCALE_LINE_COUNT ) );
mverdy 20:626b92b70bf7 1750 GraphObjectDraw( &( MenuObjects[RNG_DS1_LINE + i - 1] ), NULL, false, false );
mverdy 20:626b92b70bf7 1751 DrawText( RNG_DS1_TEXT + i - 1, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 1752 }
mverdy 20:626b92b70bf7 1753 // Clear the area for 2 downstair buttons (7 & 8)
mverdy 20:626b92b70bf7 1754 // { Id, Type, Xpos, Ypos, Height, Width, LineWidth, BackColor, \
mverdy 20:626b92b70bf7 1755 FrontColor, DoFill, FillCol, Source, TouchActive }
mverdy 20:626b92b70bf7 1756 GraphObjectClear( &clearRect, true );
mverdy 20:626b92b70bf7 1757 GraphObjectDraw( &( MenuObjects[PAGE_BORDER] ), NULL, false, false );
mverdy 20:626b92b70bf7 1758 DrawText( RNG_DIST_TEXT, ( uint8_t* )"Range: -----", NULL, NULL );
mverdy 20:626b92b70bf7 1759 DrawText( LINE5_COL0_TEXT, ( uint8_t* )"Raw [m] :", ( uint8_t* )" -----", NULL );
mverdy 20:626b92b70bf7 1760 DrawText( LINE6_COL0_TEXT, ( uint8_t* )"Packet :", ( uint8_t* )GetMenuDemoNumSentPacket( ), NULL );
mverdy 20:626b92b70bf7 1761 DrawText( LINE7_COL0_TEXT, ( uint8_t* )"FEI [Hz] :", ( uint8_t* )GetFrequencyError( ), NULL );
mverdy 20:626b92b70bf7 1762 DrawText( LINE8_COL0_TEXT, ( uint8_t* )"Channel :", ( uint8_t* )GetRngChannelsOk( ), NULL );
mverdy 20:626b92b70bf7 1763
mverdy 20:626b92b70bf7 1764 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" EXIT", NULL );
mverdy 20:626b92b70bf7 1765 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1766 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" SETTINGS", NULL );
mverdy 20:626b92b70bf7 1767 // draw active rectangle for user touch (like "REFRESH" button)
mverdy 20:626b92b70bf7 1768 GraphObjectDraw( &( MenuObjects[RNG_MST_SCR] ), NULL, false, true );
mverdy 20:626b92b70bf7 1769 }
mverdy 20:626b92b70bf7 1770 CurrentPage = PAGE_RANGING_MASTER;
mverdy 20:626b92b70bf7 1771 break;
mverdy 20:626b92b70bf7 1772
mverdy 20:626b92b70bf7 1773 case PAGE_RANGING_SLAVE:
mverdy 20:626b92b70bf7 1774 if( CurrentPage == PAGE_RANGING_SLAVE )
mverdy 20:626b92b70bf7 1775 {
mverdy 20:626b92b70bf7 1776 if( Eeprom.EepromData.DemoSettings.HoldDemo == true )
mverdy 20:626b92b70bf7 1777 {
mverdy 20:626b92b70bf7 1778 ButtonChangeText( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1779 }
mverdy 20:626b92b70bf7 1780 DrawText( LINE4_COL0_TEXT, NULL, ( uint8_t* )GetMenuDemoNumSentPacket( ), NULL );
mverdy 20:626b92b70bf7 1781 DrawText( LINE5_COL0_TEXT, NULL, ( uint8_t* )GetFrequencyError( ), NULL );
mverdy 20:626b92b70bf7 1782 DrawText( LINE6_COL0_TEXT, NULL, ( uint8_t* )GetRngChannelsOk( ), NULL );
mverdy 20:626b92b70bf7 1783 sprintf( StringText ," %s", GetRangingAntenna( ) );
mverdy 20:626b92b70bf7 1784 DrawText( LINE7_COL0_TEXT, NULL, ( uint8_t* )StringText, NULL );
mverdy 20:626b92b70bf7 1785 }
mverdy 20:626b92b70bf7 1786 else
mverdy 20:626b92b70bf7 1787 {
mverdy 20:626b92b70bf7 1788 DrawText( TITLE_TEXT, ( uint8_t* )" Outdoor ranging demo", NULL, NULL );
mverdy 20:626b92b70bf7 1789 DisplayCurrentRadioParams( PAGE_RANGING_SLAVE );
mverdy 20:626b92b70bf7 1790 DrawText( LINE4_COL0_TEXT, ( uint8_t* )"Packet :", ( uint8_t* )GetMenuDemoNumSentPacket( ), NULL );
mverdy 20:626b92b70bf7 1791 DrawText( LINE5_COL0_TEXT, ( uint8_t* )"FEI [Hz] :", ( uint8_t* )GetFrequencyError( ), NULL );
mverdy 20:626b92b70bf7 1792 DrawText( LINE6_COL0_TEXT, ( uint8_t* )"Channel :", ( uint8_t* )GetRngChannelsOk( ), NULL );
mverdy 20:626b92b70bf7 1793 sprintf( StringText ," %s", GetRangingAntenna( ) );
mverdy 20:626b92b70bf7 1794 DrawText( LINE7_COL0_TEXT, ( uint8_t* )"Antenna :", ( uint8_t* )StringText, NULL );
mverdy 20:626b92b70bf7 1795 DrawActiveButton( BTN0_BORDER, ( uint8_t* )" SLAVE", NULL );
mverdy 20:626b92b70bf7 1796 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" EXIT", NULL );
mverdy 20:626b92b70bf7 1797 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1798 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" SETTINGS", NULL );
mverdy 20:626b92b70bf7 1799 }
mverdy 20:626b92b70bf7 1800 CurrentPage = PAGE_RANGING_SLAVE;
mverdy 20:626b92b70bf7 1801 break;
mverdy 20:626b92b70bf7 1802
mverdy 20:626b92b70bf7 1803 case PAGE_RADIO_PARAM:
mverdy 20:626b92b70bf7 1804 if( CurrentPage == PAGE_RADIO_PARAM )
mverdy 20:626b92b70bf7 1805 {
mverdy 20:626b92b70bf7 1806 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING )
mverdy 20:626b92b70bf7 1807 {
mverdy 20:626b92b70bf7 1808 if( PreviousPage == START_PAGE )
mverdy 20:626b92b70bf7 1809 {
mverdy 20:626b92b70bf7 1810 ButtonChangeText( BTN0_BORDER, NULL, ( uint8_t* )GetMenuRadioFrameType( ) );
mverdy 20:626b92b70bf7 1811 }
mverdy 20:626b92b70bf7 1812 else
mverdy 20:626b92b70bf7 1813 {
mverdy 20:626b92b70bf7 1814 RemoveButton( BTN0_BORDER );
mverdy 20:626b92b70bf7 1815 }
mverdy 20:626b92b70bf7 1816 DrawActiveButton( BTN6_BORDER, ( uint8_t* )" RANGING SETTINGS", NULL );
mverdy 20:626b92b70bf7 1817 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" BEST SET", NULL );
mverdy 20:626b92b70bf7 1818 }
mverdy 20:626b92b70bf7 1819 else
mverdy 20:626b92b70bf7 1820 {
mverdy 20:626b92b70bf7 1821 DrawActiveButton( BTN0_BORDER, ( uint8_t* )"Mod:", ( uint8_t* )GetMenuRadioFrameType( ) );
mverdy 20:626b92b70bf7 1822 DrawActiveButton( BTN6_BORDER, ( uint8_t* )"Payload:", ( uint8_t* )GetRadioPayloadLength( ) );
mverdy 20:626b92b70bf7 1823 RemoveButton( BTN9_BORDER );
mverdy 20:626b92b70bf7 1824 }
mverdy 20:626b92b70bf7 1825 ButtonChangeText( BTN1_BORDER, NULL, ( uint8_t* )GetRadioFrequency( ) );
mverdy 20:626b92b70bf7 1826 ButtonChangeText( BTN2_BORDER, NULL, ( uint8_t* )GetRadioTxPower( ) );
mverdy 20:626b92b70bf7 1827 ButtonChangeText( BTN3_BORDER, NULL, ( uint8_t* )GetRadioModulationParameters1( ) );
mverdy 20:626b92b70bf7 1828 ButtonChangeText( BTN4_BORDER, NULL, ( uint8_t* )GetRadioModulationParameters2( ) );
mverdy 20:626b92b70bf7 1829 ButtonChangeText( BTN5_BORDER, NULL, ( uint8_t* )GetRadioModulationParameters3( ) );
mverdy 20:626b92b70bf7 1830 }
mverdy 20:626b92b70bf7 1831 else
mverdy 20:626b92b70bf7 1832 {
mverdy 20:626b92b70bf7 1833 DrawText( TITLE_TEXT, ( uint8_t* )" Radio Settings", NULL, NULL );
mverdy 20:626b92b70bf7 1834 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING )
mverdy 20:626b92b70bf7 1835 {
mverdy 20:626b92b70bf7 1836 if( PreviousPage == START_PAGE )
mverdy 20:626b92b70bf7 1837 {
mverdy 20:626b92b70bf7 1838 DrawActiveButton( BTN0_BORDER, ( uint8_t* )"Mod:", ( uint8_t* )GetMenuRadioFrameType( ) );
mverdy 20:626b92b70bf7 1839 }
mverdy 20:626b92b70bf7 1840 DrawActiveButton( BTN6_BORDER, ( uint8_t* )" RANGING SETTINGS", NULL );
mverdy 20:626b92b70bf7 1841 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" BEST SET", NULL );
mverdy 20:626b92b70bf7 1842 }
mverdy 20:626b92b70bf7 1843 else
mverdy 20:626b92b70bf7 1844 {
mverdy 20:626b92b70bf7 1845 DrawActiveButton( BTN0_BORDER, ( uint8_t* )"Mod:", ( uint8_t* )GetMenuRadioFrameType( ) );
mverdy 20:626b92b70bf7 1846 DrawActiveButton( BTN6_BORDER, ( uint8_t* )"Payload:", ( uint8_t* )GetRadioPayloadLength( ) );
mverdy 20:626b92b70bf7 1847 }
mverdy 20:626b92b70bf7 1848 DrawActiveButton( BTN1_BORDER, ( uint8_t* )"Freq:", ( uint8_t* )GetRadioFrequency( ) );
mverdy 20:626b92b70bf7 1849 DrawActiveButton( BTN2_BORDER, ( uint8_t* )"Tx Pow:", ( uint8_t* )GetRadioTxPower( ) );
mverdy 20:626b92b70bf7 1850 DrawActiveButton( BTN3_BORDER, ( uint8_t* )"Param 1:", ( uint8_t* )GetRadioModulationParameters1( ) );
mverdy 20:626b92b70bf7 1851 DrawActiveButton( BTN4_BORDER, ( uint8_t* )"Param 2:", ( uint8_t* )GetRadioModulationParameters2( ) );
mverdy 20:626b92b70bf7 1852 DrawActiveButton( BTN5_BORDER, ( uint8_t* )"Param 3:", ( uint8_t* )GetRadioModulationParameters3( ) );
mverdy 20:626b92b70bf7 1853 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" CANCEL", NULL );
mverdy 20:626b92b70bf7 1854 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" OK & SAVE", NULL );
mverdy 20:626b92b70bf7 1855 CurrentPage = PAGE_RADIO_PARAM;
mverdy 20:626b92b70bf7 1856 }
mverdy 20:626b92b70bf7 1857 break;
mverdy 20:626b92b70bf7 1858
mverdy 20:626b92b70bf7 1859 case PAGE_RANGING_PARAM:
mverdy 20:626b92b70bf7 1860 if( CurrentPage != PAGE_RANGING_PARAM )
mverdy 20:626b92b70bf7 1861 {
mverdy 20:626b92b70bf7 1862 DrawText( TITLE_TEXT, ( uint8_t* )" Settings : Ranging", NULL, NULL );
mverdy 20:626b92b70bf7 1863
mverdy 20:626b92b70bf7 1864 DrawActiveButton( BTN1_BORDER, ( uint8_t* )"Request:", ( uint8_t* )GetRangingRequestCount( ) );
mverdy 20:626b92b70bf7 1865 DrawActiveButton( BTN2_BORDER, ( uint8_t* )"Address:", ( uint8_t* )GetRangingAddress( ) );
mverdy 20:626b92b70bf7 1866 DrawActiveButton( BTN3_BORDER, ( uint8_t* )"Antenna:", ( uint8_t* )GetRangingAntenna( ) );
mverdy 20:626b92b70bf7 1867 DrawActiveButton( BTN4_BORDER, ( uint8_t* )"Unit:", ( uint8_t* )GetRangingUnit( ) );
mverdy 20:626b92b70bf7 1868 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" CANCEL", NULL );
mverdy 20:626b92b70bf7 1869 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" OK & SAVE", NULL );
mverdy 20:626b92b70bf7 1870 }
mverdy 20:626b92b70bf7 1871 CurrentPage = PAGE_RANGING_PARAM;
mverdy 20:626b92b70bf7 1872 break;
mverdy 20:626b92b70bf7 1873
mverdy 20:626b92b70bf7 1874 case PAGE_RADIO_PARAM_FREQ:
mverdy 20:626b92b70bf7 1875 if( CurrentPage != PAGE_RADIO_PARAM_FREQ )
mverdy 20:626b92b70bf7 1876 {
mverdy 20:626b92b70bf7 1877 DrawText( TITLE_TEXT, ( uint8_t* )" Radio Settings : Freq", NULL, NULL );
mverdy 20:626b92b70bf7 1878 DrawActiveButton( BTN0_BORDER, ( uint8_t* )" -", NULL );
mverdy 20:626b92b70bf7 1879 DrawActiveButton( BTN1_BORDER, ( uint8_t* )"Step:", ( uint8_t* )GetRadioFreqBase( ) );
mverdy 20:626b92b70bf7 1880 // do not draw boarder for indicate actual frequency (it is not a button)
mverdy 20:626b92b70bf7 1881 ButtonChangeText( BTN2_BORDER, ( uint8_t* )"Freq:", ( uint8_t* )GetRadioFrequency( ) );
mverdy 20:626b92b70bf7 1882 DrawActiveButton( BTN3_BORDER, ( uint8_t* )"Preset1:", ( uint8_t* )GetRadioFreqBasePS1( ) );
mverdy 20:626b92b70bf7 1883 DrawActiveButton( BTN4_BORDER, ( uint8_t* )"Preset2:", ( uint8_t* )GetRadioFreqBasePS2( ) );
mverdy 20:626b92b70bf7 1884 DrawActiveButton( BTN5_BORDER, ( uint8_t* )"Preset3:", ( uint8_t* )GetRadioFreqBasePS3( ) );
mverdy 20:626b92b70bf7 1885 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" CANCEL", NULL );
mverdy 20:626b92b70bf7 1886 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" OK", NULL );
mverdy 20:626b92b70bf7 1887 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" +", NULL );
mverdy 20:626b92b70bf7 1888 }
mverdy 20:626b92b70bf7 1889 CurrentPage = PAGE_RADIO_PARAM_FREQ;
mverdy 20:626b92b70bf7 1890 break;
mverdy 20:626b92b70bf7 1891
mverdy 20:626b92b70bf7 1892 case PAGE_UTILITIES:
mverdy 20:626b92b70bf7 1893 if( CurrentPage == PAGE_UTILITIES )
mverdy 20:626b92b70bf7 1894 {
mverdy 20:626b92b70bf7 1895 DrawText( LINE1_TEXT, ( uint8_t* )GetGpsTime( ), NULL, NULL );
mverdy 20:626b92b70bf7 1896 DrawText( LINE2_TEXT, ( uint8_t* )GetGpsPos( ), NULL, NULL );
mverdy 20:626b92b70bf7 1897 DrawText( LINE3_TEXT, ( uint8_t* )GetProximityValue( ), NULL, NULL );
mverdy 20:626b92b70bf7 1898 }
mverdy 20:626b92b70bf7 1899 else
mverdy 20:626b92b70bf7 1900 {
mverdy 20:626b92b70bf7 1901 char version_holder[50];
mverdy 20:626b92b70bf7 1902 sprintf(&version_holder[0], "Version: %s (%s)", FIRMWARE_VERSION, FIRMWARE_DATE);
mverdy 20:626b92b70bf7 1903 DrawText( TITLE_TEXT, ( uint8_t* )" Utilities", NULL, NULL );
mverdy 20:626b92b70bf7 1904 // FIRMWARE_VERSION is defined in DemoApplication.h
mverdy 20:626b92b70bf7 1905 DrawText( LINE0_TEXT, ( uint8_t* )version_holder, NULL, NULL );
mverdy 20:626b92b70bf7 1906 DrawText( LINE1_TEXT, ( uint8_t* )GetGpsTime( ), NULL, NULL );
mverdy 20:626b92b70bf7 1907 DrawText( LINE2_TEXT, ( uint8_t* )GetGpsPos( ), NULL, NULL );
mverdy 20:626b92b70bf7 1908 DrawText( LINE3_TEXT, ( uint8_t* )GetProximityValue( ), NULL, NULL );
mverdy 20:626b92b70bf7 1909 DrawActiveButton( BTN0_BORDER, ( uint8_t* )"Fact. Reset", NULL );
mverdy 20:626b92b70bf7 1910 DrawActiveButton( BTN4_BORDER, ( uint8_t* )"PA Mode:", ( uint8_t* )GetMenuDemoRadioPowerMode( ) );
mverdy 20:626b92b70bf7 1911 DrawActiveButton( BTN5_BORDER, ( uint8_t* )"Packets:", ( uint8_t* )GetMenuDemoMaxNumPacket( ) );
mverdy 20:626b92b70bf7 1912 DrawActiveButton( BTN6_BORDER, ( uint8_t* )"Antenna:", ( uint8_t* )GetAntennaSetting( ) );
mverdy 20:626b92b70bf7 1913 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" CANCEL", NULL );
mverdy 20:626b92b70bf7 1914 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" OK & SAVE", NULL );
mverdy 20:626b92b70bf7 1915 }
mverdy 20:626b92b70bf7 1916 CurrentPage = PAGE_UTILITIES;
mverdy 20:626b92b70bf7 1917 break;
mverdy 20:626b92b70bf7 1918
mverdy 20:626b92b70bf7 1919 case PAGE_RADIO_TEST:
mverdy 20:626b92b70bf7 1920 DrawText( TITLE_TEXT, ( uint8_t* )" Radio Test Modes", NULL, NULL );
mverdy 20:626b92b70bf7 1921 DrawActiveButton( BTN1_BORDER, ( uint8_t* )" Sleep Mode", NULL );
mverdy 20:626b92b70bf7 1922 DrawActiveButton( BTN2_BORDER, ( uint8_t* )" Standby RC Mode", NULL );
mverdy 20:626b92b70bf7 1923 DrawActiveButton( BTN3_BORDER, ( uint8_t* )" Standby XOSC Mode", NULL );
mverdy 20:626b92b70bf7 1924 DrawActiveButton( BTN4_BORDER, ( uint8_t* )" Set Tx CW", NULL );
mverdy 20:626b92b70bf7 1925 DrawActiveButton( BTN5_BORDER, ( uint8_t* )" Set Cont. Modulation", NULL );
mverdy 20:626b92b70bf7 1926 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" BACK", NULL );
mverdy 20:626b92b70bf7 1927 CurrentPage = PAGE_RADIO_TEST;
mverdy 20:626b92b70bf7 1928 break;
mverdy 20:626b92b70bf7 1929
mverdy 20:626b92b70bf7 1930 case PAGE_SLEEP_MODE:
mverdy 20:626b92b70bf7 1931 if( CurrentPage != PAGE_UTILITIES )
mverdy 20:626b92b70bf7 1932 {
mverdy 20:626b92b70bf7 1933 DrawText( TITLE_TEXT, ( uint8_t* )" Sleep Mode", NULL, NULL );
mverdy 20:626b92b70bf7 1934 DisplayCurrentRadioParams( PAGE_SLEEP_MODE );
mverdy 20:626b92b70bf7 1935 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" EXIT", NULL );
mverdy 20:626b92b70bf7 1936 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1937 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" SETTINGS", NULL );
mverdy 20:626b92b70bf7 1938 CurrentPage = PAGE_SLEEP_MODE;
mverdy 20:626b92b70bf7 1939 }
mverdy 20:626b92b70bf7 1940 break;
mverdy 20:626b92b70bf7 1941
mverdy 20:626b92b70bf7 1942 case PAGE_STBY_RC_MODE:
mverdy 20:626b92b70bf7 1943 if( CurrentPage != PAGE_STBY_RC_MODE )
mverdy 20:626b92b70bf7 1944 {
mverdy 20:626b92b70bf7 1945 DrawText( TITLE_TEXT, ( uint8_t* )" Standby RC Mode", NULL, NULL );
mverdy 20:626b92b70bf7 1946 DisplayCurrentRadioParams( PAGE_STBY_RC_MODE );
mverdy 20:626b92b70bf7 1947 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" EXIT", NULL );
mverdy 20:626b92b70bf7 1948 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1949 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" SETTINGS", NULL );
mverdy 20:626b92b70bf7 1950 CurrentPage = PAGE_STBY_RC_MODE;
mverdy 20:626b92b70bf7 1951 }
mverdy 20:626b92b70bf7 1952 break;
mverdy 20:626b92b70bf7 1953
mverdy 20:626b92b70bf7 1954 case PAGE_STBY_XOSC_MODE:
mverdy 20:626b92b70bf7 1955 if( CurrentPage != PAGE_STBY_XOSC_MODE )
mverdy 20:626b92b70bf7 1956 {
mverdy 20:626b92b70bf7 1957 DrawText( TITLE_TEXT, ( uint8_t* )" Standby XOSC Mode", NULL, NULL );
mverdy 20:626b92b70bf7 1958 DisplayCurrentRadioParams( PAGE_STBY_XOSC_MODE );
mverdy 20:626b92b70bf7 1959 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" EXIT", NULL );
mverdy 20:626b92b70bf7 1960 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1961 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" SETTINGS", NULL );
mverdy 20:626b92b70bf7 1962 CurrentPage = PAGE_STBY_XOSC_MODE;
mverdy 20:626b92b70bf7 1963 }
mverdy 20:626b92b70bf7 1964 break;
mverdy 20:626b92b70bf7 1965
mverdy 20:626b92b70bf7 1966 case PAGE_TX_CW:
mverdy 20:626b92b70bf7 1967 if( CurrentPage != PAGE_TX_CW )
mverdy 20:626b92b70bf7 1968 {
mverdy 20:626b92b70bf7 1969 DrawText( TITLE_TEXT, ( uint8_t* )" Set Tx CW", NULL, NULL );
mverdy 20:626b92b70bf7 1970 DisplayCurrentRadioParams( PAGE_TX_CW );
mverdy 20:626b92b70bf7 1971 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" EXIT", NULL );
mverdy 20:626b92b70bf7 1972 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1973 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" SETTINGS", NULL );
mverdy 20:626b92b70bf7 1974 CurrentPage = PAGE_TX_CW;
mverdy 20:626b92b70bf7 1975 }
mverdy 20:626b92b70bf7 1976 break;
mverdy 20:626b92b70bf7 1977
mverdy 20:626b92b70bf7 1978 case PAGE_CONT_MODULATION:
mverdy 20:626b92b70bf7 1979 if( CurrentPage != PAGE_CONT_MODULATION )
mverdy 20:626b92b70bf7 1980 {
mverdy 20:626b92b70bf7 1981 DrawText( TITLE_TEXT, ( uint8_t* )" Set Cont. Modulation", NULL, NULL );
mverdy 20:626b92b70bf7 1982 DisplayCurrentRadioParams( PAGE_CONT_MODULATION );
mverdy 20:626b92b70bf7 1983 DrawActiveButton( BTN7_BORDER, ( uint8_t* )" EXIT", NULL );
mverdy 20:626b92b70bf7 1984 DrawActiveButton( BTN8_BORDER, ( uint8_t* )" START", NULL );
mverdy 20:626b92b70bf7 1985 DrawActiveButton( BTN9_BORDER, ( uint8_t* )" SETTINGS", NULL );
mverdy 20:626b92b70bf7 1986 CurrentPage = PAGE_CONT_MODULATION;
mverdy 20:626b92b70bf7 1987 }
mverdy 20:626b92b70bf7 1988 break;
mverdy 20:626b92b70bf7 1989
mverdy 20:626b92b70bf7 1990 default:
mverdy 20:626b92b70bf7 1991 break;
mverdy 20:626b92b70bf7 1992 }
mverdy 20:626b92b70bf7 1993 }
lex9296 21:ab8027016a2c 1994 */
mverdy 20:626b92b70bf7 1995
lex9296 21:ab8027016a2c 1996 /*
mverdy 20:626b92b70bf7 1997 void DisplayCurrentRadioParams( uint8_t page )
mverdy 20:626b92b70bf7 1998 {
mverdy 20:626b92b70bf7 1999 switch( page )
mverdy 20:626b92b70bf7 2000 {
mverdy 20:626b92b70bf7 2001 case PAGE_SLEEP_MODE:
mverdy 20:626b92b70bf7 2002 case PAGE_STBY_RC_MODE:
mverdy 20:626b92b70bf7 2003 case PAGE_STBY_XOSC_MODE:
mverdy 20:626b92b70bf7 2004 case PAGE_TX_CW:
mverdy 20:626b92b70bf7 2005 // Do display different without packet settings (no modulation here)
mverdy 20:626b92b70bf7 2006 // 2 + (9) + 4 + (7) + 2 + (4) = 28 (=<28 : ok)
mverdy 20:626b92b70bf7 2007 sprintf( StringText ,"f:%s, P:%s, %s", GetRadioFrequencyGHz( ), \
mverdy 20:626b92b70bf7 2008 GetRadioTxPower( ), GetAntennaSetting( ) );
mverdy 20:626b92b70bf7 2009 DrawText( LINE0_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2010 sprintf( StringText ,"Radio Power Mode: %s", ( uint8_t* )GetMenuDemoRadioPowerMode( ) );
mverdy 20:626b92b70bf7 2011 DrawText( LINE1_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2012 sprintf( StringText ,"Press START to launch test" );
mverdy 20:626b92b70bf7 2013 DrawText( LINE3_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2014 break;
mverdy 20:626b92b70bf7 2015
mverdy 20:626b92b70bf7 2016 case PAGE_CONT_MODULATION:
mverdy 20:626b92b70bf7 2017 // 2 + (9) + 4 + (7) + 2 + (4) = 28 (=<28 : ok)
mverdy 20:626b92b70bf7 2018 sprintf( StringText ,"f:%s, P:%s, %s", GetRadioFrequencyGHz( ), \
mverdy 20:626b92b70bf7 2019 GetRadioTxPower( ), GetAntennaSetting( ) );
mverdy 20:626b92b70bf7 2020 DrawText( LINE0_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2021 // (7) + 2 + (19) = 28 (=<28 : ok)
mverdy 20:626b92b70bf7 2022 sprintf( StringText ,"%s: %s", GetMenuRadioFrameType( ), \
mverdy 20:626b92b70bf7 2023 GetRadioModulationParameters1( ) );
mverdy 20:626b92b70bf7 2024 DrawText( LINE1_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2025 // (3) + 2 + (10) + 2 + (8) = 25 (=<28 : ok)
mverdy 20:626b92b70bf7 2026 sprintf( StringText ,"%s, %s, %s", GetRadioModulationParameters2( ), \
mverdy 20:626b92b70bf7 2027 GetRadioModulationParameters3( ),
mverdy 20:626b92b70bf7 2028 ( uint8_t* )GetMenuDemoRadioPowerMode( ) );
mverdy 20:626b92b70bf7 2029 DrawText( LINE2_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2030 sprintf( StringText ,"Press START to launch test" );
mverdy 20:626b92b70bf7 2031 DrawText( LINE4_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2032 break;
mverdy 20:626b92b70bf7 2033
mverdy 20:626b92b70bf7 2034 case PAGE_PING_PONG: // standart display
mverdy 20:626b92b70bf7 2035 case PAGE_PER:
mverdy 20:626b92b70bf7 2036 // 2 + (9) + 4 + (7) + 2 + (4) = 28 (=<28 : ok)
mverdy 20:626b92b70bf7 2037 sprintf( StringText ,"f:%s, P:%s, %s", GetRadioFrequencyGHz( ), \
mverdy 20:626b92b70bf7 2038 GetRadioTxPower( ), GetAntennaSetting( ) );
mverdy 20:626b92b70bf7 2039 DrawText( LINE0_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2040 // (7) + 2 + (19) = 28 (=<28 : ok)
mverdy 20:626b92b70bf7 2041 sprintf( StringText ,"%s: %s", GetMenuRadioFrameType( ), \
mverdy 20:626b92b70bf7 2042 GetRadioModulationParameters1( ) );
mverdy 20:626b92b70bf7 2043 DrawText( LINE1_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2044 // 3 + (3) + 2 + (10) + 2 + (8) = 28 (=<28 : ok)
mverdy 20:626b92b70bf7 2045 sprintf( StringText ,"PL:%s, %s, %s", GetRadioPayloadLength( ), \
mverdy 20:626b92b70bf7 2046 GetRadioModulationParameters2( ), \
mverdy 20:626b92b70bf7 2047 GetRadioModulationParameters3( ) );
mverdy 20:626b92b70bf7 2048 DrawText( LINE2_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2049 break;
mverdy 20:626b92b70bf7 2050
mverdy 20:626b92b70bf7 2051 case PAGE_RANGING_SLAVE:
mverdy 20:626b92b70bf7 2052 // 2 + (9) + 4 + (7) = 22 (=<28 : ok)
mverdy 20:626b92b70bf7 2053 sprintf( StringText ,"f:%s, P:%s", GetRadioFrequencyGHz( ), \
mverdy 20:626b92b70bf7 2054 GetRadioTxPower( ) );
mverdy 20:626b92b70bf7 2055 DrawText( LINE0_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2056 // (7) + 2 + (19) = 28 (=<28 : ok)
mverdy 20:626b92b70bf7 2057 sprintf( StringText ,"%s: %s", GetMenuRadioFrameType( ), \
mverdy 20:626b92b70bf7 2058 GetRadioModulationParameters1( ) );
mverdy 20:626b92b70bf7 2059 DrawText( LINE1_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2060 // (10) + 2 + (8) = 20 (=<28 : ok)
mverdy 20:626b92b70bf7 2061 sprintf( StringText ,"%s", GetRadioModulationParameters2( ) );
mverdy 20:626b92b70bf7 2062 DrawText( LINE2_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2063 break;
mverdy 20:626b92b70bf7 2064
mverdy 20:626b92b70bf7 2065 case PAGE_RANGING_MASTER:
mverdy 20:626b92b70bf7 2066 sprintf( StringText ,"f:%s", GetRadioFrequencyGHz( ) );
mverdy 20:626b92b70bf7 2067 DrawText( LINE1_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2068 DrawText( LINE2_COL0_TEXT, ( uint8_t* )"Antenna", ( uint8_t* )GetRangingAntenna( ), NULL );
mverdy 20:626b92b70bf7 2069 sprintf( StringText ,"%s", GetRadioTxPower( ) );
mverdy 20:626b92b70bf7 2070 MenuObjects[LINE3_COL1_TEXT].FrontColor = TEXT_COLOR;
mverdy 20:626b92b70bf7 2071 DrawText( LINE3_COL0_TEXT, ( uint8_t* )"Tx Power", ( uint8_t* )StringText, NULL );
mverdy 20:626b92b70bf7 2072 sprintf( StringText ,"%s", GetRadioModulationParameters2( ) );
mverdy 20:626b92b70bf7 2073 DrawText( LINE4_COL0_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2074 sprintf( StringText ,"%s", GetRadioModulationParameters1( ) );
mverdy 20:626b92b70bf7 2075 MenuObjects[LINE4_COL1_TEXT].FrontColor = TEXT_COLOR;
mverdy 20:626b92b70bf7 2076 DrawText( LINE4_COL1_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2077 MenuObjects[LINE3_COL1_TEXT].FrontColor = TEXT_VALUE;
mverdy 20:626b92b70bf7 2078 MenuObjects[LINE4_COL1_TEXT].FrontColor = TEXT_VALUE;
mverdy 20:626b92b70bf7 2079 break;
mverdy 20:626b92b70bf7 2080 }
mverdy 20:626b92b70bf7 2081 }
lex9296 21:ab8027016a2c 2082 */
mverdy 20:626b92b70bf7 2083
lex9296 21:ab8027016a2c 2084 /*
mverdy 20:626b92b70bf7 2085 char* GetMenuRadioFrameType( void )
mverdy 20:626b92b70bf7 2086 {
mverdy 20:626b92b70bf7 2087 switch( Eeprom.EepromData.DemoSettings.ModulationType )
mverdy 20:626b92b70bf7 2088 {
mverdy 20:626b92b70bf7 2089 case PACKET_TYPE_FLRC: return ( char* )" FLRC";
mverdy 20:626b92b70bf7 2090 case PACKET_TYPE_RANGING: return ( char* )"RANGING";
mverdy 20:626b92b70bf7 2091 case PACKET_TYPE_GFSK: return ( char* )" GFSK";
mverdy 20:626b92b70bf7 2092 case PACKET_TYPE_BLE: return ( char* )" BLE";
mverdy 20:626b92b70bf7 2093 case PACKET_TYPE_LORA:
mverdy 20:626b92b70bf7 2094 default: return ( char* )" LORA";
mverdy 20:626b92b70bf7 2095 }
mverdy 20:626b92b70bf7 2096 }
lex9296 21:ab8027016a2c 2097 */
mverdy 20:626b92b70bf7 2098
lex9296 21:ab8027016a2c 2099 /*
mverdy 20:626b92b70bf7 2100 char* GetRadioModulationParameters1( void )
mverdy 20:626b92b70bf7 2101 {
mverdy 20:626b92b70bf7 2102 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
mverdy 20:626b92b70bf7 2103 {
mverdy 20:626b92b70bf7 2104 switch( Eeprom.EepromData.DemoSettings.ModulationParam1 )
mverdy 20:626b92b70bf7 2105 {
mverdy 20:626b92b70bf7 2106 case FLRC_BR_1_300_BW_1_2: return ( char* )"1.3 Mbps/BW 1.2 MHz";
mverdy 20:626b92b70bf7 2107 case FLRC_BR_1_040_BW_1_2: return ( char* )"1.0 Mbps/BW 1.2 MHz";
mverdy 20:626b92b70bf7 2108 case FLRC_BR_0_650_BW_0_6: return ( char* )"650 kbps/BW 600 kHz";
mverdy 20:626b92b70bf7 2109 case FLRC_BR_0_520_BW_0_6: return ( char* )"520 kbps/BW 600 kHz";
mverdy 20:626b92b70bf7 2110 case FLRC_BR_0_325_BW_0_3: return ( char* )"325 kbps/BW 300 kHz";
mverdy 20:626b92b70bf7 2111 case FLRC_BR_0_260_BW_0_3: return ( char* )"260 kbps/BW 300 kHz";
mverdy 20:626b92b70bf7 2112 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2113 }
mverdy 20:626b92b70bf7 2114 }
mverdy 20:626b92b70bf7 2115 else if( ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_GFSK ) || \
mverdy 20:626b92b70bf7 2116 ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_BLE ) )
mverdy 20:626b92b70bf7 2117 {
mverdy 20:626b92b70bf7 2118 switch( Eeprom.EepromData.DemoSettings.ModulationParam1 )
mverdy 20:626b92b70bf7 2119 {
mverdy 20:626b92b70bf7 2120 case GFSK_BLE_BR_2_000_BW_2_4: return ( char* )"2.0 Mbps/BW 2.4 MHz";
mverdy 20:626b92b70bf7 2121 case GFSK_BLE_BR_1_600_BW_2_4: return ( char* )"1.6 Mbps/BW 2.4 MHz";
mverdy 20:626b92b70bf7 2122 case GFSK_BLE_BR_1_000_BW_2_4: return ( char* )"1.0 Mbps/BW 2.4 MHz";
mverdy 20:626b92b70bf7 2123 case GFSK_BLE_BR_1_000_BW_1_2: return ( char* )"1.0 Mbps/BW 1.2 MHz";
mverdy 20:626b92b70bf7 2124 case GFSK_BLE_BR_0_800_BW_2_4: return ( char* )"800 kbps/BW 2.4 MHz";
mverdy 20:626b92b70bf7 2125 case GFSK_BLE_BR_0_800_BW_1_2: return ( char* )"800 kbps/BW 1.2 MHz";
mverdy 20:626b92b70bf7 2126 case GFSK_BLE_BR_0_500_BW_1_2: return ( char* )"500 kbps/BW 1.2 MHz";
mverdy 20:626b92b70bf7 2127 case GFSK_BLE_BR_0_500_BW_0_6: return ( char* )"500 kbps/BW 600 kHz";
mverdy 20:626b92b70bf7 2128 case GFSK_BLE_BR_0_400_BW_1_2: return ( char* )"400 kbps/BW 1.2 MHz";
mverdy 20:626b92b70bf7 2129 case GFSK_BLE_BR_0_400_BW_0_6: return ( char* )"400 kbps/BW 600 kHz";
mverdy 20:626b92b70bf7 2130 case GFSK_BLE_BR_0_250_BW_0_6: return ( char* )"250 kbps/BW 600 kHz";
mverdy 20:626b92b70bf7 2131 case GFSK_BLE_BR_0_250_BW_0_3: return ( char* )"250 kbps/BW 300 kHz";
mverdy 20:626b92b70bf7 2132 case GFSK_BLE_BR_0_125_BW_0_3: return ( char* )"125 kbps/BW 300 kHz";
mverdy 20:626b92b70bf7 2133 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2134 }
mverdy 20:626b92b70bf7 2135 }
mverdy 20:626b92b70bf7 2136 else if( ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_LORA ) || \
mverdy 20:626b92b70bf7 2137 ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING ) )
mverdy 20:626b92b70bf7 2138 {
mverdy 20:626b92b70bf7 2139 switch( Eeprom.EepromData.DemoSettings.ModulationParam1 )
mverdy 20:626b92b70bf7 2140 {
mverdy 20:626b92b70bf7 2141 case LORA_SF5: return ( char* )"SF5";
mverdy 20:626b92b70bf7 2142 case LORA_SF6: return ( char* )"SF6";
mverdy 20:626b92b70bf7 2143 case LORA_SF7: return ( char* )"SF7";
mverdy 20:626b92b70bf7 2144 case LORA_SF8: return ( char* )"SF8";
mverdy 20:626b92b70bf7 2145 case LORA_SF9: return ( char* )"SF9";
mverdy 20:626b92b70bf7 2146 case LORA_SF10: return ( char* )"SF10";
mverdy 20:626b92b70bf7 2147 case LORA_SF11: return ( char* )"SF11";
mverdy 20:626b92b70bf7 2148 case LORA_SF12: return ( char* )"SF12";
mverdy 20:626b92b70bf7 2149 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2150 }
mverdy 20:626b92b70bf7 2151 }
mverdy 20:626b92b70bf7 2152 else
mverdy 20:626b92b70bf7 2153 {
mverdy 20:626b92b70bf7 2154 return ( char* )"";
mverdy 20:626b92b70bf7 2155 }
mverdy 20:626b92b70bf7 2156 }
lex9296 21:ab8027016a2c 2157 */
mverdy 20:626b92b70bf7 2158
lex9296 21:ab8027016a2c 2159 /*
mverdy 20:626b92b70bf7 2160 char* GetRadioModulationParameters2( void )
mverdy 20:626b92b70bf7 2161 {
mverdy 20:626b92b70bf7 2162 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
mverdy 20:626b92b70bf7 2163 {
mverdy 20:626b92b70bf7 2164 switch( Eeprom.EepromData.DemoSettings.ModulationParam2 )
mverdy 20:626b92b70bf7 2165 {
mverdy 20:626b92b70bf7 2166 case FLRC_CR_1_2: return ( char* )"CR 1/2";
mverdy 20:626b92b70bf7 2167 case FLRC_CR_3_4: return ( char* )"CR 3/4";
mverdy 20:626b92b70bf7 2168 case FLRC_CR_1_0: return ( char* )"CR 1";
mverdy 20:626b92b70bf7 2169 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2170 }
mverdy 20:626b92b70bf7 2171 }
mverdy 20:626b92b70bf7 2172 else if( ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_GFSK ) || \
mverdy 20:626b92b70bf7 2173 ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_BLE ) )
mverdy 20:626b92b70bf7 2174 {
mverdy 20:626b92b70bf7 2175 switch( Eeprom.EepromData.DemoSettings.ModulationParam2 )
mverdy 20:626b92b70bf7 2176 {
mverdy 20:626b92b70bf7 2177 case GFSK_BLE_MOD_IND_0_35: return ( char* )"Mod.i 0.35";
mverdy 20:626b92b70bf7 2178 case GFSK_BLE_MOD_IND_0_50: return ( char* )"Mod.i 0.5";
mverdy 20:626b92b70bf7 2179 case GFSK_BLE_MOD_IND_0_75: return ( char* )"Mod.i 0.75";
mverdy 20:626b92b70bf7 2180 case GFSK_BLE_MOD_IND_1_00: return ( char* )"Mod.i 1";
mverdy 20:626b92b70bf7 2181 case GFSK_BLE_MOD_IND_1_25: return ( char* )"Mod.i 1.25";
mverdy 20:626b92b70bf7 2182 case GFSK_BLE_MOD_IND_1_50: return ( char* )"Mod.i 1.5";
mverdy 20:626b92b70bf7 2183 case GFSK_BLE_MOD_IND_1_75: return ( char* )"Mod.i 1.75";
mverdy 20:626b92b70bf7 2184 case GFSK_BLE_MOD_IND_2_00: return ( char* )"Mod.i 2";
mverdy 20:626b92b70bf7 2185 case GFSK_BLE_MOD_IND_2_25: return ( char* )"Mod.i 2.25";
mverdy 20:626b92b70bf7 2186 case GFSK_BLE_MOD_IND_2_50: return ( char* )"Mod.i 2.50";
mverdy 20:626b92b70bf7 2187 case GFSK_BLE_MOD_IND_2_75: return ( char* )"Mod.i 2.75";
mverdy 20:626b92b70bf7 2188 case GFSK_BLE_MOD_IND_3_00: return ( char* )"Mod.i 3";
mverdy 20:626b92b70bf7 2189 case GFSK_BLE_MOD_IND_3_25: return ( char* )"Mod.i 3.25";
mverdy 20:626b92b70bf7 2190 case GFSK_BLE_MOD_IND_3_50: return ( char* )"Mod.i 3.5";
mverdy 20:626b92b70bf7 2191 case GFSK_BLE_MOD_IND_3_75: return ( char* )"Mod.i 3.75";
mverdy 20:626b92b70bf7 2192 case GFSK_BLE_MOD_IND_4_00: return ( char* )"Mod.i 4";
mverdy 20:626b92b70bf7 2193 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2194 }
mverdy 20:626b92b70bf7 2195 }
mverdy 20:626b92b70bf7 2196 else if( ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_LORA ) || \
mverdy 20:626b92b70bf7 2197 ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING ) )
mverdy 20:626b92b70bf7 2198 {
mverdy 20:626b92b70bf7 2199 switch( Eeprom.EepromData.DemoSettings.ModulationParam2 )
mverdy 20:626b92b70bf7 2200 {
mverdy 20:626b92b70bf7 2201 case LORA_BW_0200: return ( char* )"BW 200 kHz";
mverdy 20:626b92b70bf7 2202 case LORA_BW_0400: return ( char* )"BW 400 kHz";
mverdy 20:626b92b70bf7 2203 case LORA_BW_0800: return ( char* )"BW 800 kHz";
mverdy 20:626b92b70bf7 2204 case LORA_BW_1600: return ( char* )"BW 1.6 MHz";
mverdy 20:626b92b70bf7 2205 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2206 }
mverdy 20:626b92b70bf7 2207 }
mverdy 20:626b92b70bf7 2208 else
mverdy 20:626b92b70bf7 2209 {
mverdy 20:626b92b70bf7 2210 return ( char* )"";
mverdy 20:626b92b70bf7 2211 }
mverdy 20:626b92b70bf7 2212 }
lex9296 21:ab8027016a2c 2213 */
mverdy 20:626b92b70bf7 2214
lex9296 21:ab8027016a2c 2215 /*
mverdy 20:626b92b70bf7 2216 char* GetRadioModulationParameters3( void )
mverdy 20:626b92b70bf7 2217 {
mverdy 20:626b92b70bf7 2218 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_FLRC )
mverdy 20:626b92b70bf7 2219 {
mverdy 20:626b92b70bf7 2220 switch( Eeprom.EepromData.DemoSettings.ModulationParam3 )
mverdy 20:626b92b70bf7 2221 {
mverdy 20:626b92b70bf7 2222 case RADIO_MOD_SHAPING_BT_OFF: return ( char* )"BT OFF";
mverdy 20:626b92b70bf7 2223 case RADIO_MOD_SHAPING_BT_1_0: return ( char* )"BT 1";
mverdy 20:626b92b70bf7 2224 case RADIO_MOD_SHAPING_BT_0_5: return ( char* )"BT 0.5";
mverdy 20:626b92b70bf7 2225 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2226 }
mverdy 20:626b92b70bf7 2227 }
mverdy 20:626b92b70bf7 2228 else if( ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_GFSK ) || \
mverdy 20:626b92b70bf7 2229 ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_BLE ) )
mverdy 20:626b92b70bf7 2230 {
mverdy 20:626b92b70bf7 2231 switch( Eeprom.EepromData.DemoSettings.ModulationParam3 )
mverdy 20:626b92b70bf7 2232 {
mverdy 20:626b92b70bf7 2233 case RADIO_MOD_SHAPING_BT_OFF: return ( char* )"BT OFF";
mverdy 20:626b92b70bf7 2234 case RADIO_MOD_SHAPING_BT_1_0: return ( char* )"BT 1";
mverdy 20:626b92b70bf7 2235 case RADIO_MOD_SHAPING_BT_0_5: return ( char* )"BT 0.5";
mverdy 20:626b92b70bf7 2236 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2237 }
mverdy 20:626b92b70bf7 2238 }
mverdy 20:626b92b70bf7 2239 else if( ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_LORA ) || \
mverdy 20:626b92b70bf7 2240 ( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_RANGING ) )
mverdy 20:626b92b70bf7 2241 {
mverdy 20:626b92b70bf7 2242 switch( Eeprom.EepromData.DemoSettings.ModulationParam3 )
mverdy 20:626b92b70bf7 2243 {
mverdy 20:626b92b70bf7 2244 case LORA_CR_4_5: return ( char* )"CR 4/5";
mverdy 20:626b92b70bf7 2245 case LORA_CR_4_6: return ( char* )"CR 4/6";
mverdy 20:626b92b70bf7 2246 case LORA_CR_4_7: return ( char* )"CR 4/7";
mverdy 20:626b92b70bf7 2247 case LORA_CR_4_8: return ( char* )"CR 4/8";
mverdy 20:626b92b70bf7 2248 case LORA_CR_LI_4_5: return ( char* )"CRLI 4/5";
mverdy 20:626b92b70bf7 2249 case LORA_CR_LI_4_6: return ( char* )"CRLI 4/6";
mverdy 20:626b92b70bf7 2250 case LORA_CR_LI_4_7: return ( char* )"CRLI 4/7";
mverdy 20:626b92b70bf7 2251 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2252 }
mverdy 20:626b92b70bf7 2253 }
mverdy 20:626b92b70bf7 2254 else
mverdy 20:626b92b70bf7 2255 {
mverdy 20:626b92b70bf7 2256 return ( char* )"";
mverdy 20:626b92b70bf7 2257 }
mverdy 20:626b92b70bf7 2258 }
lex9296 21:ab8027016a2c 2259 */
mverdy 20:626b92b70bf7 2260
lex9296 21:ab8027016a2c 2261 /*
mverdy 20:626b92b70bf7 2262 char* GetRadioFrequency( void )
mverdy 20:626b92b70bf7 2263 {
mverdy 20:626b92b70bf7 2264 sprintf( StringText2, "%lu Hz", \
mverdy 20:626b92b70bf7 2265 ( unsigned long )Eeprom.EepromData.DemoSettings.Frequency );
mverdy 20:626b92b70bf7 2266 return StringText2;
mverdy 20:626b92b70bf7 2267 }
mverdy 20:626b92b70bf7 2268
mverdy 20:626b92b70bf7 2269 void UpdateRadioFrequency( unsigned long freq )
mverdy 20:626b92b70bf7 2270 {
mverdy 20:626b92b70bf7 2271 sprintf( StringText ,"f:%1d.%03d GHz, P:%s, %s", freq / 1000000000, ( freq / 1000000 ) % 1000, GetRadioTxPower( ), GetAntennaSetting( ) );
mverdy 20:626b92b70bf7 2272 DrawText( LINE0_TEXT, ( uint8_t* )StringText, NULL, NULL );
mverdy 20:626b92b70bf7 2273 }
mverdy 20:626b92b70bf7 2274
mverdy 20:626b92b70bf7 2275 char* GetRadioFrequencyGHz( void )
mverdy 20:626b92b70bf7 2276 {
mverdy 20:626b92b70bf7 2277 // quicker than using a float (which is not optimized in MBED)
mverdy 20:626b92b70bf7 2278 sprintf( StringText3, "%1d.%03d GHz", \
mverdy 20:626b92b70bf7 2279 Eeprom.EepromData.DemoSettings.Frequency / 1000000000, \
mverdy 20:626b92b70bf7 2280 ( Eeprom.EepromData.DemoSettings.Frequency / 1000000 ) % 1000 );
mverdy 20:626b92b70bf7 2281 return StringText3;
mverdy 20:626b92b70bf7 2282 }
mverdy 20:626b92b70bf7 2283
mverdy 20:626b92b70bf7 2284 char* GetRadioFreqBase( void )
mverdy 20:626b92b70bf7 2285 {
mverdy 20:626b92b70bf7 2286 switch( CurrentFreqBase )
mverdy 20:626b92b70bf7 2287 {
mverdy 20:626b92b70bf7 2288 case FB1: return ( char* )"1 Hz";
mverdy 20:626b92b70bf7 2289 case FB10: return ( char* )"10 Hz";
mverdy 20:626b92b70bf7 2290 case FB100: return ( char* )"100 Hz";
mverdy 20:626b92b70bf7 2291 case FB1K: return ( char* )"1 kHz";
mverdy 20:626b92b70bf7 2292 case FB10K: return ( char* )"10 kHz";
mverdy 20:626b92b70bf7 2293 case FB100K: return ( char* )"100 kHz";
mverdy 20:626b92b70bf7 2294 case FB1M: return ( char* )"1 MHz";
mverdy 20:626b92b70bf7 2295 case FB10M: return ( char* )"10 MHz";
mverdy 20:626b92b70bf7 2296 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2297 }
mverdy 20:626b92b70bf7 2298 }
mverdy 20:626b92b70bf7 2299
mverdy 20:626b92b70bf7 2300 char* GetRadioFreqBasePS1( void )
mverdy 20:626b92b70bf7 2301 {
mverdy 20:626b92b70bf7 2302 sprintf( StringText, "%lu Hz", DEMO_CENTRAL_FREQ_PRESET1 );
mverdy 20:626b92b70bf7 2303 return StringText;
mverdy 20:626b92b70bf7 2304 }
mverdy 20:626b92b70bf7 2305
mverdy 20:626b92b70bf7 2306 char* GetRadioFreqBasePS2( void )
mverdy 20:626b92b70bf7 2307 {
mverdy 20:626b92b70bf7 2308 sprintf( StringText, "%lu Hz", DEMO_CENTRAL_FREQ_PRESET2 );
mverdy 20:626b92b70bf7 2309 return StringText;
mverdy 20:626b92b70bf7 2310 }
mverdy 20:626b92b70bf7 2311
mverdy 20:626b92b70bf7 2312 char* GetRadioFreqBasePS3( void )
mverdy 20:626b92b70bf7 2313 {
mverdy 20:626b92b70bf7 2314 sprintf( StringText, "%lu Hz", DEMO_CENTRAL_FREQ_PRESET3 );
mverdy 20:626b92b70bf7 2315 return StringText;
mverdy 20:626b92b70bf7 2316 }
mverdy 20:626b92b70bf7 2317
mverdy 20:626b92b70bf7 2318 char* GetRadioTxPower( void )
mverdy 20:626b92b70bf7 2319 {
mverdy 20:626b92b70bf7 2320 sprintf( StringText2, "%d dBm", Eeprom.EepromData.DemoSettings.TxPower );
mverdy 20:626b92b70bf7 2321 return StringText2;
mverdy 20:626b92b70bf7 2322 }
mverdy 20:626b92b70bf7 2323
mverdy 20:626b92b70bf7 2324 char* GetRadioPayloadLength( void )
mverdy 20:626b92b70bf7 2325 {
mverdy 20:626b92b70bf7 2326 if( Eeprom.EepromData.DemoSettings.ModulationType == PACKET_TYPE_LORA )
mverdy 20:626b92b70bf7 2327 {
mverdy 20:626b92b70bf7 2328 sprintf( StringText2, "%d", Eeprom.EepromData.DemoSettings.PacketParam3 );
mverdy 20:626b92b70bf7 2329 }
mverdy 20:626b92b70bf7 2330 else // PACKET_TYPE_GFSK, PACKET_TYPE_FLRC
mverdy 20:626b92b70bf7 2331 {
mverdy 20:626b92b70bf7 2332 sprintf( StringText2, "%d", Eeprom.EepromData.DemoSettings.PacketParam5 );
mverdy 20:626b92b70bf7 2333 }
mverdy 20:626b92b70bf7 2334 return StringText2;
mverdy 20:626b92b70bf7 2335 }
mverdy 20:626b92b70bf7 2336
mverdy 20:626b92b70bf7 2337 char* GetMenuDemoMaxNumPacket( void )
mverdy 20:626b92b70bf7 2338 {
mverdy 20:626b92b70bf7 2339 if( Eeprom.EepromData.DemoSettings.MaxNumPacket == 0 )
mverdy 20:626b92b70bf7 2340 {
mverdy 20:626b92b70bf7 2341 return ( char* )"Infinite";
mverdy 20:626b92b70bf7 2342 }
mverdy 20:626b92b70bf7 2343 else
mverdy 20:626b92b70bf7 2344 {
mverdy 20:626b92b70bf7 2345 sprintf( StringText, "%6d", Eeprom.EepromData.DemoSettings.MaxNumPacket );
mverdy 20:626b92b70bf7 2346 }
mverdy 20:626b92b70bf7 2347 return StringText;
mverdy 20:626b92b70bf7 2348 }
mverdy 20:626b92b70bf7 2349
mverdy 20:626b92b70bf7 2350 char* GetMenuDemoNumSentPacket( void )
mverdy 20:626b92b70bf7 2351 {
mverdy 20:626b92b70bf7 2352 sprintf( StringText2, "%6d", Eeprom.EepromData.DemoSettings.CntPacketTx );
mverdy 20:626b92b70bf7 2353 return StringText2;
mverdy 20:626b92b70bf7 2354 }
mverdy 20:626b92b70bf7 2355
mverdy 20:626b92b70bf7 2356 char* GetMenuDemoRxOk( void )
mverdy 20:626b92b70bf7 2357 {
mverdy 20:626b92b70bf7 2358 sprintf( StringText2, "%6lu", \
mverdy 20:626b92b70bf7 2359 ( unsigned long )( Eeprom.EepromData.DemoSettings.CntPacketRxOK ) );
mverdy 20:626b92b70bf7 2360 return StringText2;
mverdy 20:626b92b70bf7 2361 }
mverdy 20:626b92b70bf7 2362
mverdy 20:626b92b70bf7 2363 char* GetMenuDemoRxKo( void )
mverdy 20:626b92b70bf7 2364 {
mverdy 20:626b92b70bf7 2365 sprintf( StringText2, "%6lu", \
mverdy 20:626b92b70bf7 2366 ( unsigned long )( Eeprom.EepromData.DemoSettings.CntPacketRxKO + \
mverdy 20:626b92b70bf7 2367 Eeprom.EepromData.DemoSettings.RxTimeOutCount ) );
mverdy 20:626b92b70bf7 2368 return StringText2;
mverdy 20:626b92b70bf7 2369 }
mverdy 20:626b92b70bf7 2370
mverdy 20:626b92b70bf7 2371 char* GetMenuDemoRxOkSlave( void )
mverdy 20:626b92b70bf7 2372 {
mverdy 20:626b92b70bf7 2373 sprintf( StringText3, "%6lu", \
mverdy 20:626b92b70bf7 2374 ( unsigned long )( Eeprom.EepromData.DemoSettings.CntPacketRxOKSlave ) );
mverdy 20:626b92b70bf7 2375 return StringText3;
mverdy 20:626b92b70bf7 2376 }
mverdy 20:626b92b70bf7 2377
mverdy 20:626b92b70bf7 2378 char* GetMenuDemoResultPerCent1( uint32_t value, uint32_t reference )
mverdy 20:626b92b70bf7 2379 {
mverdy 20:626b92b70bf7 2380 // quicker than using a float (which is not optimized in MBED)
mverdy 20:626b92b70bf7 2381 sprintf( StringText2, "%3d.%02d", \
mverdy 20:626b92b70bf7 2382 ( ( value * 10000 ) / reference ) / 100, \
mverdy 20:626b92b70bf7 2383 ( ( value * 10000 ) / reference ) % 100 );
mverdy 20:626b92b70bf7 2384 return StringText2;
mverdy 20:626b92b70bf7 2385 }
mverdy 20:626b92b70bf7 2386
mverdy 20:626b92b70bf7 2387 char* GetMenuDemoResultPerCent2( uint32_t value, uint32_t reference )
mverdy 20:626b92b70bf7 2388 {
mverdy 20:626b92b70bf7 2389 // quicker than using a float (which is not optimized in MBED)
mverdy 20:626b92b70bf7 2390 sprintf( StringText3, "%3d.%02d", \
mverdy 20:626b92b70bf7 2391 ( ( value * 10000 ) / reference ) / 100, \
mverdy 20:626b92b70bf7 2392 ( ( value * 10000 ) / reference ) % 100 );
mverdy 20:626b92b70bf7 2393 return StringText3;
mverdy 20:626b92b70bf7 2394 }
mverdy 20:626b92b70bf7 2395
mverdy 20:626b92b70bf7 2396 char* GetMenuDemoRxKoSlave( void )
mverdy 20:626b92b70bf7 2397 {
mverdy 20:626b92b70bf7 2398 sprintf( StringText3, "%6lu", \
mverdy 20:626b92b70bf7 2399 ( unsigned long )( Eeprom.EepromData.DemoSettings.CntPacketRxKOSlave ) );
mverdy 20:626b92b70bf7 2400 return StringText3;
mverdy 20:626b92b70bf7 2401 }
mverdy 20:626b92b70bf7 2402
mverdy 20:626b92b70bf7 2403 char* GetMenuDemoRssi( void )
mverdy 20:626b92b70bf7 2404 {
mverdy 20:626b92b70bf7 2405 sprintf( StringText2, "%6d", Eeprom.EepromData.DemoSettings.RssiValue );
mverdy 20:626b92b70bf7 2406 return StringText2;
mverdy 20:626b92b70bf7 2407 }
mverdy 20:626b92b70bf7 2408
mverdy 20:626b92b70bf7 2409 char* GetMenuDemoSnr( void )
mverdy 20:626b92b70bf7 2410 {
mverdy 20:626b92b70bf7 2411 if( Eeprom.EepromData.DemoSettings.SnrValue >= 0 )
mverdy 20:626b92b70bf7 2412 {
mverdy 20:626b92b70bf7 2413 sprintf( StringText2, " /" );
mverdy 20:626b92b70bf7 2414 }
mverdy 20:626b92b70bf7 2415 else
mverdy 20:626b92b70bf7 2416 {
mverdy 20:626b92b70bf7 2417 sprintf( StringText2, "%6d", Eeprom.EepromData.DemoSettings.SnrValue );
mverdy 20:626b92b70bf7 2418 }
mverdy 20:626b92b70bf7 2419 return StringText2;
mverdy 20:626b92b70bf7 2420 }
mverdy 20:626b92b70bf7 2421
mverdy 20:626b92b70bf7 2422 char* GetAntennaSetting( void )
mverdy 20:626b92b70bf7 2423 {
mverdy 20:626b92b70bf7 2424 if( Eeprom.EepromData.DemoSettings.AntennaSwitch == 0 )
mverdy 20:626b92b70bf7 2425 {
mverdy 20:626b92b70bf7 2426 return ( char* )"ANT1";
mverdy 20:626b92b70bf7 2427 }
mverdy 20:626b92b70bf7 2428 else
mverdy 20:626b92b70bf7 2429 {
mverdy 20:626b92b70bf7 2430 return ( char* )"ANT0";
mverdy 20:626b92b70bf7 2431 }
mverdy 20:626b92b70bf7 2432 }
mverdy 20:626b92b70bf7 2433
mverdy 20:626b92b70bf7 2434 char* GetTotalPackets( void )
mverdy 20:626b92b70bf7 2435 {
mverdy 20:626b92b70bf7 2436 if( Eeprom.EepromData.DemoSettings.MaxNumPacket == 0 )
mverdy 20:626b92b70bf7 2437 {
mverdy 20:626b92b70bf7 2438 return ( char* )"Total: Inf.";
mverdy 20:626b92b70bf7 2439 }
mverdy 20:626b92b70bf7 2440 else
mverdy 20:626b92b70bf7 2441 {
mverdy 20:626b92b70bf7 2442 sprintf( StringText, "Total: %5lu", \
mverdy 20:626b92b70bf7 2443 ( unsigned long )( Eeprom.EepromData.DemoSettings.MaxNumPacket ) );
mverdy 20:626b92b70bf7 2444 return StringText;
mverdy 20:626b92b70bf7 2445 }
mverdy 20:626b92b70bf7 2446 }
mverdy 20:626b92b70bf7 2447
mverdy 20:626b92b70bf7 2448 #if defined(HAS_GPS_SENSOR)
mverdy 20:626b92b70bf7 2449 char* GetGpsTime( void )
mverdy 20:626b92b70bf7 2450 {
mverdy 20:626b92b70bf7 2451 thisGps = Max7GpsgetData( );
mverdy 20:626b92b70bf7 2452 if( ( thisGps->Position.Fixed ) && ( thisGps->Time.Updated ) )
mverdy 20:626b92b70bf7 2453 {
mverdy 20:626b92b70bf7 2454 sprintf( StringText, "GPS: %s.%s.%s %s:%s:%s", thisGps->Time.Year, \
mverdy 20:626b92b70bf7 2455 thisGps->Time.Month, \
mverdy 20:626b92b70bf7 2456 thisGps->Time.Day, \
mverdy 20:626b92b70bf7 2457 thisGps->Time.Hour, \
mverdy 20:626b92b70bf7 2458 thisGps->Time.Minute, \
mverdy 20:626b92b70bf7 2459 thisGps->Time.Second );
mverdy 20:626b92b70bf7 2460 thisGps->Time.Updated = false;
mverdy 20:626b92b70bf7 2461 return StringText;
mverdy 20:626b92b70bf7 2462 }
mverdy 20:626b92b70bf7 2463 else
mverdy 20:626b92b70bf7 2464 {
mverdy 20:626b92b70bf7 2465 return ( char* )"GPS: Satellites searching..";
mverdy 20:626b92b70bf7 2466 }
mverdy 20:626b92b70bf7 2467 }
mverdy 20:626b92b70bf7 2468
mverdy 20:626b92b70bf7 2469 char* GetGpsPos( void )
mverdy 20:626b92b70bf7 2470 {
mverdy 20:626b92b70bf7 2471 thisGps = Max7GpsgetData( );
mverdy 20:626b92b70bf7 2472 if( thisGps->Position.Fixed )
mverdy 20:626b92b70bf7 2473 {
mverdy 20:626b92b70bf7 2474 sprintf( StringText,"%s, %s", thisGps->Position.Lat, \
mverdy 20:626b92b70bf7 2475 thisGps->Position.Long );
mverdy 20:626b92b70bf7 2476 return StringText;
mverdy 20:626b92b70bf7 2477 }
mverdy 20:626b92b70bf7 2478 else
mverdy 20:626b92b70bf7 2479 {
mverdy 20:626b92b70bf7 2480 return ( char* )"Pos: Satellites searching..";
mverdy 20:626b92b70bf7 2481 }
mverdy 20:626b92b70bf7 2482 }
mverdy 20:626b92b70bf7 2483 #else
mverdy 20:626b92b70bf7 2484 char* GetGpsTime( void )
mverdy 20:626b92b70bf7 2485 {
mverdy 20:626b92b70bf7 2486 return ( char* )"";
mverdy 20:626b92b70bf7 2487 }
mverdy 20:626b92b70bf7 2488
mverdy 20:626b92b70bf7 2489 char* GetGpsPos( void )
mverdy 20:626b92b70bf7 2490 {
mverdy 20:626b92b70bf7 2491 return ( char* )"GPS: Not supported";
mverdy 20:626b92b70bf7 2492 }
mverdy 20:626b92b70bf7 2493 #endif
mverdy 20:626b92b70bf7 2494
mverdy 20:626b92b70bf7 2495 #if defined(HAS_PROXIMITY_SENSOR)
mverdy 20:626b92b70bf7 2496 char* GetProximityValue( void )
mverdy 20:626b92b70bf7 2497 {
mverdy 20:626b92b70bf7 2498 sprintf( StringText,"Proximity : %06d, %06d", \
mverdy 20:626b92b70bf7 2499 SX9306proximityGetReadValue( 1 ), \
mverdy 20:626b92b70bf7 2500 SX9306proximityGetReadValue( 0 ) ); // Left then right
mverdy 20:626b92b70bf7 2501 return StringText;
mverdy 20:626b92b70bf7 2502 }
mverdy 20:626b92b70bf7 2503 #else
mverdy 20:626b92b70bf7 2504 char* GetProximityValue( void )
mverdy 20:626b92b70bf7 2505 {
mverdy 20:626b92b70bf7 2506 return ( char * )"Proximity: Not supported";
mverdy 20:626b92b70bf7 2507 }
mverdy 20:626b92b70bf7 2508 #endif
mverdy 20:626b92b70bf7 2509
mverdy 20:626b92b70bf7 2510 char* GetMenuDemoRadioPowerMode( void )
mverdy 20:626b92b70bf7 2511 {
mverdy 20:626b92b70bf7 2512 if( Eeprom.EepromData.DemoSettings.RadioPowerMode == USE_LDO )
mverdy 20:626b92b70bf7 2513 {
mverdy 20:626b92b70bf7 2514 return ( char* )" LDO";
mverdy 20:626b92b70bf7 2515 }
mverdy 20:626b92b70bf7 2516 else
mverdy 20:626b92b70bf7 2517 {
mverdy 20:626b92b70bf7 2518 return ( char* )" DCDC";
mverdy 20:626b92b70bf7 2519 }
mverdy 20:626b92b70bf7 2520 }
mverdy 20:626b92b70bf7 2521
mverdy 20:626b92b70bf7 2522 char* GetFrequencyError( void )
mverdy 20:626b92b70bf7 2523 {
mverdy 20:626b92b70bf7 2524 sprintf( StringText2, "%6d", ( int32_t )Eeprom.EepromData.DemoSettings.RngFei );
mverdy 20:626b92b70bf7 2525 return StringText2;
mverdy 20:626b92b70bf7 2526 }
mverdy 20:626b92b70bf7 2527
mverdy 20:626b92b70bf7 2528 char* GetRngChannelsOk( void )
mverdy 20:626b92b70bf7 2529 {
mverdy 20:626b92b70bf7 2530 if( Eeprom.EepromData.DemoSettings.Entity == SLAVE )
mverdy 20:626b92b70bf7 2531 {
mverdy 20:626b92b70bf7 2532 Eeprom.EepromData.DemoSettings.CntPacketRxOK /= 2;
mverdy 20:626b92b70bf7 2533 }
mverdy 20:626b92b70bf7 2534 sprintf( StringText2, "%03d/%03d", Eeprom.EepromData.DemoSettings.CntPacketRxOK, Eeprom.EepromData.DemoSettings.RngRequestCount );
mverdy 20:626b92b70bf7 2535 return StringText2;
mverdy 20:626b92b70bf7 2536 }
mverdy 20:626b92b70bf7 2537
mverdy 20:626b92b70bf7 2538 char* GetRangingRequestCount( void )
mverdy 20:626b92b70bf7 2539 {
mverdy 20:626b92b70bf7 2540 sprintf( StringText2, "%d", Eeprom.EepromData.DemoSettings.RngRequestCount );
mverdy 20:626b92b70bf7 2541 return StringText2;
mverdy 20:626b92b70bf7 2542 }
mverdy 20:626b92b70bf7 2543
mverdy 20:626b92b70bf7 2544 char* GetRangingAddress( void )
mverdy 20:626b92b70bf7 2545 {
mverdy 20:626b92b70bf7 2546 sprintf( StringText2, "0x%08x", Eeprom.EepromData.DemoSettings.RngAddress );
mverdy 20:626b92b70bf7 2547 return StringText2;
mverdy 20:626b92b70bf7 2548 }
mverdy 20:626b92b70bf7 2549
mverdy 20:626b92b70bf7 2550 char* GetRangingAntenna( void )
mverdy 20:626b92b70bf7 2551 {
mverdy 20:626b92b70bf7 2552 switch( Eeprom.EepromData.DemoSettings.RngAntenna )
mverdy 20:626b92b70bf7 2553 {
mverdy 20:626b92b70bf7 2554 case DEMO_RNG_ANT_1: return ( char* )"ANT1";
mverdy 20:626b92b70bf7 2555 case DEMO_RNG_ANT_0: return ( char* )"ANT0";
mverdy 20:626b92b70bf7 2556 case DEMO_RNG_ANT_BOTH: return ( char* )"BOTH";
mverdy 20:626b92b70bf7 2557 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2558 }
mverdy 20:626b92b70bf7 2559 }
mverdy 20:626b92b70bf7 2560
mverdy 20:626b92b70bf7 2561 char* GetRangingUnit( void )
mverdy 20:626b92b70bf7 2562 {
mverdy 20:626b92b70bf7 2563 switch( Eeprom.EepromData.DemoSettings.RngUnit )
mverdy 20:626b92b70bf7 2564 {
mverdy 20:626b92b70bf7 2565 case DEMO_RNG_UNIT_SEL_M: return ( char* )"Meter";
mverdy 20:626b92b70bf7 2566 case DEMO_RNG_UNIT_SEL_YD: return ( char* )"Yard";
mverdy 20:626b92b70bf7 2567 case DEMO_RNG_UNIT_SEL_MI: return ( char* )"Mile";
mverdy 20:626b92b70bf7 2568 default: return ( char* )"X";
mverdy 20:626b92b70bf7 2569 }
mverdy 20:626b92b70bf7 2570 }
lex9296 21:ab8027016a2c 2571 */
mverdy 20:626b92b70bf7 2572
mverdy 20:626b92b70bf7 2573 void CheckScreen( void )
mverdy 20:626b92b70bf7 2574 {
mverdy 20:626b92b70bf7 2575 CheckScreenFlag = true;
mverdy 20:626b92b70bf7 2576 }
mverdy 20:626b92b70bf7 2577
mverdy 20:626b92b70bf7 2578 void CheckRefresh( void )
mverdy 20:626b92b70bf7 2579 {
mverdy 20:626b92b70bf7 2580 PageRefresh = true;
mverdy 20:626b92b70bf7 2581 }
mverdy 20:626b92b70bf7 2582
mverdy 20:626b92b70bf7 2583 void DebouncedScreen (void )
mverdy 20:626b92b70bf7 2584 {
mverdy 20:626b92b70bf7 2585 ScreenBeenDebounced = false;
mverdy 20:626b92b70bf7 2586 DebouncedScreenTouch.detach( );
mverdy 20:626b92b70bf7 2587 }
mverdy 20:626b92b70bf7 2588
mverdy 20:626b92b70bf7 2589 /*!
mverdy 20:626b92b70bf7 2590 * \brief Draw button
mverdy 20:626b92b70bf7 2591 *
mverdy 20:626b92b70bf7 2592 * \param [in] buttonId Id of the button to draw
mverdy 20:626b92b70bf7 2593 * \param [in] *text1 Text to draw as label
mverdy 20:626b92b70bf7 2594 * \param [in] *text2 Text to draw as value
mverdy 20:626b92b70bf7 2595 */
mverdy 20:626b92b70bf7 2596 void DrawActiveButton( uint8_t buttonId, uint8_t* text1, uint8_t* text2 )
mverdy 20:626b92b70bf7 2597 {
mverdy 20:626b92b70bf7 2598 GraphObjectDraw( &( MenuObjects[buttonId] ), NULL, NULL, true );
mverdy 20:626b92b70bf7 2599 if( text2 == NULL )
mverdy 20:626b92b70bf7 2600 {
mverdy 20:626b92b70bf7 2601 if( text1 != NULL )
mverdy 20:626b92b70bf7 2602 {
mverdy 20:626b92b70bf7 2603 GraphObjectDraw( &( MenuObjects[buttonId + 1] ), text1, NULL, false );
mverdy 20:626b92b70bf7 2604 }
mverdy 20:626b92b70bf7 2605 }
mverdy 20:626b92b70bf7 2606 else
mverdy 20:626b92b70bf7 2607 {
mverdy 20:626b92b70bf7 2608 if( text1 != NULL )
mverdy 20:626b92b70bf7 2609 {
mverdy 20:626b92b70bf7 2610 GraphObjectDraw( &( MenuObjects[buttonId + 2] ), text1, NULL, false );
mverdy 20:626b92b70bf7 2611 }
mverdy 20:626b92b70bf7 2612 GraphObjectDraw( &( MenuObjects[buttonId + 3] ), text2, NULL, false );
mverdy 20:626b92b70bf7 2613 }
mverdy 20:626b92b70bf7 2614 }
mverdy 20:626b92b70bf7 2615
mverdy 20:626b92b70bf7 2616 void ButtonChangeText( uint8_t buttonId, uint8_t* text1, uint8_t* text2 )
mverdy 20:626b92b70bf7 2617 {
mverdy 20:626b92b70bf7 2618 if( text2 == NULL )
mverdy 20:626b92b70bf7 2619 {
mverdy 20:626b92b70bf7 2620 if( text1 != NULL )
mverdy 20:626b92b70bf7 2621 {
mverdy 20:626b92b70bf7 2622 GraphObjectDraw( &( MenuObjects[buttonId + 1] ), text1, NULL, false );
mverdy 20:626b92b70bf7 2623 }
mverdy 20:626b92b70bf7 2624 }
mverdy 20:626b92b70bf7 2625 else
mverdy 20:626b92b70bf7 2626 {
mverdy 20:626b92b70bf7 2627 if( text1 != NULL )
mverdy 20:626b92b70bf7 2628 {
mverdy 20:626b92b70bf7 2629 GraphObjectDraw( &( MenuObjects[buttonId + 2] ), text1, NULL, false );
mverdy 20:626b92b70bf7 2630 }
mverdy 20:626b92b70bf7 2631 GraphObjectDraw( &( MenuObjects[buttonId + 3] ), text2, NULL, false );
mverdy 20:626b92b70bf7 2632 }
mverdy 20:626b92b70bf7 2633 }
mverdy 20:626b92b70bf7 2634
mverdy 20:626b92b70bf7 2635 void RemoveButton( uint8_t buttonId )
mverdy 20:626b92b70bf7 2636 {
mverdy 20:626b92b70bf7 2637 GraphObjectClear( &( MenuObjects[buttonId] ), true );
mverdy 20:626b92b70bf7 2638 }
mverdy 20:626b92b70bf7 2639
mverdy 20:626b92b70bf7 2640 void DrawText( uint8_t lineId, uint8_t* text0, uint8_t* text1, uint8_t* text2 )
mverdy 20:626b92b70bf7 2641 {
mverdy 20:626b92b70bf7 2642 if( text0 != NULL )
mverdy 20:626b92b70bf7 2643 {
mverdy 20:626b92b70bf7 2644 GraphObjectDraw( &( MenuObjects[lineId] ), text0, NULL, false );
mverdy 20:626b92b70bf7 2645 }
mverdy 20:626b92b70bf7 2646 if( text1 != NULL )
mverdy 20:626b92b70bf7 2647 {
mverdy 20:626b92b70bf7 2648 GraphObjectDraw( &( MenuObjects[lineId + 1] ), text1, NULL, false );
mverdy 20:626b92b70bf7 2649 }
mverdy 20:626b92b70bf7 2650 if( text2 != NULL )
mverdy 20:626b92b70bf7 2651 {
mverdy 20:626b92b70bf7 2652 GraphObjectDraw( &( MenuObjects[lineId + 2] ), text2, NULL, false );
mverdy 20:626b92b70bf7 2653 }
mverdy 20:626b92b70bf7 2654 }
mverdy 20:626b92b70bf7 2655