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