Velocity Closed Loop Dynamic error correction

Dependencies:   mbed QEI PID DmTftLibraryEx

Committer:
GregCr
Date:
Mon Mar 13 15:12:05 2017 +0000
Revision:
0:9c0917bfde97
Child:
2:8ebe57eb273a
alpha release

Who changed what in which revision?

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