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