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