Check this one ! mbos setup changed, WTX hor pos changed, no font style check, no checksum check
Dependencies: 4DGL MODSERIAL mbed mbos
Fork of CDU_Mbed_21 by
FS2CDU_data_5.cpp@11:d60c746c097c, 2014-07-21 (annotated)
- Committer:
- WillemBraat
- Date:
- Mon Jul 21 14:24:15 2014 +0000
- Revision:
- 11:d60c746c097c
- Parent:
- 10:7e350a27f936
screen_handler.cpp
; Added external flag S_Exec in procedure . Inhibits screen updates when 1. S_Exec is declared in line 77 of FS2CDU_data_5.cpp
;
; keyboard2.cpp
; Line 40. Added Key_led=0
;
; keyboard2.cpp "
; Added switch value in CDU_SET_BGL_INTENSIT...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WillemBraat | 10:7e350a27f936 | 1 | |
LvdK | 8:422544d24df3 | 2 | // L. van der Kolk, ELVEDEKA, Holland // |
LvdK | 8:422544d24df3 | 3 | // File: FS2CDU_data_5.cpp |
LvdK | 8:422544d24df3 | 4 | // -- Message handling from FS to CDU -- |
LvdK | 8:422544d24df3 | 5 | // Data field analyzing and filling data structures |
LvdK | 8:422544d24df3 | 6 | |
LvdK | 8:422544d24df3 | 7 | #include "mbed.h" |
LvdK | 8:422544d24df3 | 8 | #include "MODSERIAL.h" |
LvdK | 8:422544d24df3 | 9 | #include "mbos.h" |
LvdK | 8:422544d24df3 | 10 | #include "mbos_def2.h" |
LvdK | 8:422544d24df3 | 11 | |
LvdK | 8:422544d24df3 | 12 | extern mbos CDU_OS; |
LvdK | 8:422544d24df3 | 13 | |
LvdK | 8:422544d24df3 | 14 | // ---- FS-to-CDU data structures to be filled with received data ---------------- |
LvdK | 8:422544d24df3 | 15 | #define max_text0 48 // max text position font 0 (pos 0 invalid ) |
LvdK | 8:422544d24df3 | 16 | #define max_text1 24 // max text position font 1 (pos 0 invalid ) |
LvdK | 8:422544d24df3 | 17 | #define max_lines 14 // max nr of screen lines |
LvdK | 8:422544d24df3 | 18 | #define max_col_nr 255 // highest possible R,G, or B colour number |
LvdK | 8:422544d24df3 | 19 | #define fstyle_1 'S' // possible font style character 1 |
LvdK | 8:422544d24df3 | 20 | #define fstyle_2 'N' // possible font style character 2 |
LvdK | 8:422544d24df3 | 21 | #define max_keys 100 // max total nr of select keys 0 - 99 |
LvdK | 8:422544d24df3 | 22 | #define max_leftkeys 6 // max nr of used LEFT select keys ( 0 - 49 ) |
LvdK | 8:422544d24df3 | 23 | #define max_rightkeys 6 // max nr of used RIGHT select keys ( 50 - 99 ) |
LvdK | 8:422544d24df3 | 24 | |
LvdK | 8:422544d24df3 | 25 | // Background colour of CDU display: |
LvdK | 8:422544d24df3 | 26 | struct { int BG_RED; // : RED value 0 - 255 |
LvdK | 8:422544d24df3 | 27 | int BG_GREEN; // : GREEN value 0 - 255 |
LvdK | 8:422544d24df3 | 28 | int BG_BLUE; // : BLUE value 0 - 255 |
LvdK | 8:422544d24df3 | 29 | } BACKGROUND_COL; |
LvdK | 8:422544d24df3 | 30 | |
LvdK | 8:422544d24df3 | 31 | // Maintext lines at selectkeys: |
LvdK | 8:422544d24df3 | 32 | struct { char text[55]; // : maintext string, ending with '\0' |
LvdK | 8:422544d24df3 | 33 | int font_size; // : fontsize of textline 0 or 1 |
LvdK | 8:422544d24df3 | 34 | char font_style; // : style character S or N |
LvdK | 8:422544d24df3 | 35 | int text_RED; // : RED value of textline |
LvdK | 8:422544d24df3 | 36 | int text_GREEN; // : GREEN value of textline |
LvdK | 8:422544d24df3 | 37 | int text_BLUE; // : BLUE value of textline |
LvdK | 8:422544d24df3 | 38 | } SELKEY_MAINTEXT[100]; // : array of selectkey Maintext structures |
LvdK | 8:422544d24df3 | 39 | |
LvdK | 8:422544d24df3 | 40 | // Subtext lines at selectkeys: |
LvdK | 8:422544d24df3 | 41 | struct { char text[55]; // : subtext string, ending with '\0' |
LvdK | 8:422544d24df3 | 42 | int font_size; // : fontsize of textline 0 or 1 |
LvdK | 8:422544d24df3 | 43 | char font_style; // : style character S or N |
LvdK | 8:422544d24df3 | 44 | int text_RED; // : RED value of textline |
LvdK | 8:422544d24df3 | 45 | int text_GREEN; // : GREEN value of textline |
LvdK | 8:422544d24df3 | 46 | int text_BLUE; // : BLUE value of textline |
LvdK | 8:422544d24df3 | 47 | } SELKEY_SUBTEXT[100]; // : array of selectkey Subtext structures |
LvdK | 8:422544d24df3 | 48 | |
LvdK | 8:422544d24df3 | 49 | // Screen textlines: |
LvdK | 8:422544d24df3 | 50 | struct { char text[55]; // : text line string, ending with '\0' |
LvdK | 8:422544d24df3 | 51 | int font_size; // : fontsize of textline 0 or 1 |
LvdK | 8:422544d24df3 | 52 | char font_style; // : style character S or N |
LvdK | 8:422544d24df3 | 53 | int text_RED; // : RED value of textline |
LvdK | 8:422544d24df3 | 54 | int text_GREEN; // : GREEN value of textline |
LvdK | 8:422544d24df3 | 55 | int text_BLUE; // : BLUE value of textline |
LvdK | 8:422544d24df3 | 56 | } TEXTLINE[16]; // : array of textline structures |
LvdK | 8:422544d24df3 | 57 | |
LvdK | 8:422544d24df3 | 58 | // CDU status: |
LvdK | 8:422544d24df3 | 59 | struct { int msg_indicator; // : MSG 0 = light OFF, 1 = light ON |
LvdK | 8:422544d24df3 | 60 | int exec_indicator; // : EXEC 0 = indicator OFF, 1 = indicator ON |
LvdK | 8:422544d24df3 | 61 | int fail_indicator; // : FAIL 0 = indicator OFF, 1 = indicator ON |
LvdK | 8:422544d24df3 | 62 | int dspy_indicator; // : DSPY 0 = indicator OFF, 1 = indicator ON |
LvdK | 8:422544d24df3 | 63 | int ofst_indicator; // : OFST 0 = indicator OFF, 1 = indicator ON |
LvdK | 8:422544d24df3 | 64 | int backlight; // : 0 = light OFF, 1 = light ON |
LvdK | 8:422544d24df3 | 65 | int stby_mode; // : 0 = operational mode, 1 = standby mode |
LvdK | 8:422544d24df3 | 66 | } CDU_STATUS; |
LvdK | 8:422544d24df3 | 67 | |
LvdK | 8:422544d24df3 | 68 | |
LvdK | 8:422544d24df3 | 69 | // FS_data_update_ID: |
LvdK | 8:422544d24df3 | 70 | // These global(!) flags indicate what data has been updated: |
LvdK | 8:422544d24df3 | 71 | int Background_Col_Update = 0; // : 1 when color was updated, must be reset to 0 when data has been read |
LvdK | 8:422544d24df3 | 72 | int CDU_Status_Update = 0; // : 1 when status was updated, must be reset to 0 when data has been read |
LvdK | 8:422544d24df3 | 73 | int DO_CLR_SCREEN = 0; // : 1 when screen should be cleared, must be reset to 0 when done |
LvdK | 8:422544d24df3 | 74 | int Text_Line_Update = 0; // : equal to line number whose text was updated, must be reset to 0 when text has been read |
LvdK | 8:422544d24df3 | 75 | int Key_Maintext_Update = -1; // : equal to keynumber whose main text line was updated, must be reset to -1 (!) when text has been read |
LvdK | 8:422544d24df3 | 76 | int Key_Subtext_Update = -1; // : equal to keynumber whose sub text line was updated, must be reset to -1 (!) when text has been read |
WillemBraat | 11:d60c746c097c | 77 | int S_Exec = 0; // WB 20-07-14 if 1 then S+EXEC is pressed together to enter setup mode |
WillemBraat | 11:d60c746c097c | 78 | // -->No screen updates allowed |
WillemBraat | 11:d60c746c097c | 79 | // -->No key messages sent to FS |
WillemBraat | 11:d60c746c097c | 80 | // Setup is exited by pressing EXEC |
LvdK | 8:422544d24df3 | 81 | |
LvdK | 8:422544d24df3 | 82 | //------------- debug only --------------------------- |
LvdK | 8:422544d24df3 | 83 | extern MODSERIAL SERIAL_DEBUG; // : debug serial port |
LvdK | 8:422544d24df3 | 84 | //---------------------------------------------------- |
LvdK | 8:422544d24df3 | 85 | |
LvdK | 8:422544d24df3 | 86 | extern MODSERIAL USB; |
LvdK | 8:422544d24df3 | 87 | extern char string_received[]; |
LvdK | 8:422544d24df3 | 88 | extern int comma[]; |
LvdK | 8:422544d24df3 | 89 | |
LvdK | 8:422544d24df3 | 90 | // Common flag to signal that an update was stored in the datastructures: |
LvdK | 8:422544d24df3 | 91 | int FSdata_received_flag = false; // : true when some FS-to-CDU data was updated |
LvdK | 8:422544d24df3 | 92 | |
LvdK | 8:422544d24df3 | 93 | void set_initial_data() |
LvdK | 8:422544d24df3 | 94 | { // Function to fill all FS-to-CDU datastructures with (dummy) data at initial power-up conditions. |
LvdK | 8:422544d24df3 | 95 | // Prevents non-printable chars in data structures ! |
LvdK | 8:422544d24df3 | 96 | int key_nr, line_nr; |
LvdK | 8:422544d24df3 | 97 | // Init background colour of screen : |
LvdK | 8:422544d24df3 | 98 | BACKGROUND_COL.BG_RED = 128; |
LvdK | 8:422544d24df3 | 99 | BACKGROUND_COL.BG_GREEN = 128; |
LvdK | 8:422544d24df3 | 100 | BACKGROUND_COL.BG_BLUE = 128; |
LvdK | 8:422544d24df3 | 101 | |
LvdK | 8:422544d24df3 | 102 | // Filling of all select key datastructures: |
LvdK | 8:422544d24df3 | 103 | // Init Maintext at left selectkeys starting from 0 : |
LvdK | 8:422544d24df3 | 104 | for ( key_nr = 0; key_nr < max_leftkeys; key_nr++ ) |
LvdK | 8:422544d24df3 | 105 | { SELKEY_MAINTEXT[key_nr].text_RED = 128; |
LvdK | 8:422544d24df3 | 106 | SELKEY_MAINTEXT[key_nr].text_GREEN = 128; |
LvdK | 8:422544d24df3 | 107 | SELKEY_MAINTEXT[key_nr].text_BLUE = 128; |
LvdK | 8:422544d24df3 | 108 | SELKEY_MAINTEXT[key_nr].font_size = 0; |
LvdK | 8:422544d24df3 | 109 | SELKEY_MAINTEXT[key_nr].font_style = fstyle_1; |
LvdK | 8:422544d24df3 | 110 | strcpy(SELKEY_MAINTEXT[key_nr].text, " \0"); // some space chars |
LvdK | 8:422544d24df3 | 111 | } |
LvdK | 8:422544d24df3 | 112 | // Init Maintext at right selectkeys starting from 50 : |
LvdK | 8:422544d24df3 | 113 | for ( key_nr = 50; key_nr < (50+max_rightkeys); key_nr++ ) |
LvdK | 8:422544d24df3 | 114 | { SELKEY_MAINTEXT[key_nr].text_RED = 128; |
LvdK | 8:422544d24df3 | 115 | SELKEY_MAINTEXT[key_nr].text_GREEN = 128; |
LvdK | 8:422544d24df3 | 116 | SELKEY_MAINTEXT[key_nr].text_BLUE = 128; |
LvdK | 8:422544d24df3 | 117 | SELKEY_MAINTEXT[key_nr].font_size = 0; |
LvdK | 8:422544d24df3 | 118 | SELKEY_MAINTEXT[key_nr].font_style = fstyle_1; |
LvdK | 8:422544d24df3 | 119 | strcpy(SELKEY_MAINTEXT[key_nr].text, " \0"); // some space chars |
LvdK | 8:422544d24df3 | 120 | } |
LvdK | 8:422544d24df3 | 121 | // Init Subtext at left selectkeys starting from 0 : |
LvdK | 8:422544d24df3 | 122 | for ( key_nr = 0; key_nr < max_leftkeys; key_nr++ ) |
LvdK | 8:422544d24df3 | 123 | { SELKEY_SUBTEXT[key_nr].text_RED = 128; |
LvdK | 8:422544d24df3 | 124 | SELKEY_SUBTEXT[key_nr].text_GREEN = 128; |
LvdK | 8:422544d24df3 | 125 | SELKEY_SUBTEXT[key_nr].text_BLUE = 128; |
LvdK | 8:422544d24df3 | 126 | SELKEY_SUBTEXT[key_nr].font_size = 0; |
LvdK | 8:422544d24df3 | 127 | SELKEY_SUBTEXT[key_nr].font_style = fstyle_1; |
LvdK | 8:422544d24df3 | 128 | strcpy(SELKEY_SUBTEXT[key_nr].text," \0"); // some space chars |
LvdK | 8:422544d24df3 | 129 | } |
LvdK | 8:422544d24df3 | 130 | // Init Subtext at right selectkeys starting from 50 : |
LvdK | 8:422544d24df3 | 131 | for ( key_nr = 50; key_nr < (50+max_rightkeys); key_nr++ ) |
LvdK | 8:422544d24df3 | 132 | { SELKEY_SUBTEXT[key_nr].text_RED = 128; |
LvdK | 8:422544d24df3 | 133 | SELKEY_SUBTEXT[key_nr].text_GREEN = 128; |
LvdK | 8:422544d24df3 | 134 | SELKEY_SUBTEXT[key_nr].text_BLUE = 128; |
LvdK | 8:422544d24df3 | 135 | SELKEY_SUBTEXT[key_nr].font_size = 0; |
LvdK | 8:422544d24df3 | 136 | SELKEY_SUBTEXT[key_nr].font_style = fstyle_1; |
LvdK | 8:422544d24df3 | 137 | strcpy(SELKEY_SUBTEXT[key_nr].text, " \0"); // some space chars |
LvdK | 8:422544d24df3 | 138 | } |
LvdK | 8:422544d24df3 | 139 | |
LvdK | 8:422544d24df3 | 140 | // Init screen text lines with space chars : |
LvdK | 8:422544d24df3 | 141 | for ( line_nr = 1; line_nr <= 14; line_nr++ ) |
LvdK | 8:422544d24df3 | 142 | { TEXTLINE[line_nr].text_RED = 128; |
LvdK | 8:422544d24df3 | 143 | TEXTLINE[line_nr].text_GREEN = 128; |
LvdK | 8:422544d24df3 | 144 | TEXTLINE[line_nr].text_BLUE = 128; |
LvdK | 8:422544d24df3 | 145 | TEXTLINE[line_nr].font_size = 0; |
LvdK | 8:422544d24df3 | 146 | TEXTLINE[line_nr].font_style = fstyle_1; |
LvdK | 8:422544d24df3 | 147 | strcpy(TEXTLINE[line_nr].text, " \0"); // : all space chars |
LvdK | 8:422544d24df3 | 148 | } |
LvdK | 8:422544d24df3 | 149 | // Init CDU status items: |
LvdK | 8:422544d24df3 | 150 | CDU_STATUS.msg_indicator = 0; |
LvdK | 8:422544d24df3 | 151 | CDU_STATUS.exec_indicator = 0; |
LvdK | 8:422544d24df3 | 152 | CDU_STATUS.backlight = 0; |
LvdK | 8:422544d24df3 | 153 | CDU_STATUS.stby_mode = 0; |
WillemBraat | 10:7e350a27f936 | 154 | CDU_STATUS.dspy_indicator = 0; |
WillemBraat | 10:7e350a27f936 | 155 | CDU_STATUS.fail_indicator = 0; |
WillemBraat | 10:7e350a27f936 | 156 | CDU_STATUS.ofst_indicator = 0; |
LvdK | 8:422544d24df3 | 157 | } |
LvdK | 8:422544d24df3 | 158 | |
LvdK | 8:422544d24df3 | 159 | void read_datafields(int command_number) { |
LvdK | 8:422544d24df3 | 160 | // Function to read all comma seperated datafields in string_received[] from USB |
LvdK | 8:422544d24df3 | 161 | // and fill in the FS-to-CDU data structures. |
LvdK | 8:422544d24df3 | 162 | // Parameter is found command_number by decoder. |
LvdK | 8:422544d24df3 | 163 | int colour, size, pos, line, last, cnt, k_id, a ; |
LvdK | 8:422544d24df3 | 164 | int modified, char_pntr; |
LvdK | 8:422544d24df3 | 165 | char ch; |
LvdK | 8:422544d24df3 | 166 | |
LvdK | 8:422544d24df3 | 167 | modified = false; |
LvdK | 8:422544d24df3 | 168 | //CDU_OS.LockResource(FS_DATA_RESOURCE); // : lock FS database <<--- !! |
LvdK | 8:422544d24df3 | 169 | |
LvdK | 8:422544d24df3 | 170 | switch ( command_number ) |
LvdK | 8:422544d24df3 | 171 | { case 0: |
LvdK | 8:422544d24df3 | 172 | { // 0 is no valid commandnumber, do nothing |
LvdK | 8:422544d24df3 | 173 | break; |
LvdK | 8:422544d24df3 | 174 | } |
LvdK | 8:422544d24df3 | 175 | |
LvdK | 8:422544d24df3 | 176 | case 1: // MSG command, message indicator control CDU |
LvdK | 8:422544d24df3 | 177 | { |
LvdK | 8:422544d24df3 | 178 | // Get message indicator status: |
LvdK | 8:422544d24df3 | 179 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
LvdK | 8:422544d24df3 | 180 | if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') |
LvdK | 8:422544d24df3 | 181 | { CDU_STATUS.msg_indicator = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 182 | CDU_Status_Update = 1; |
LvdK | 8:422544d24df3 | 183 | } |
LvdK | 8:422544d24df3 | 184 | break; |
LvdK | 8:422544d24df3 | 185 | } |
LvdK | 8:422544d24df3 | 186 | |
LvdK | 8:422544d24df3 | 187 | case 2: // EXC command, exec indicator control CDU |
LvdK | 8:422544d24df3 | 188 | { |
LvdK | 8:422544d24df3 | 189 | // Get exec indicator status: |
LvdK | 8:422544d24df3 | 190 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
LvdK | 8:422544d24df3 | 191 | if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') |
LvdK | 8:422544d24df3 | 192 | { CDU_STATUS.exec_indicator = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 193 | CDU_Status_Update = 1; |
LvdK | 8:422544d24df3 | 194 | } |
LvdK | 8:422544d24df3 | 195 | break; |
LvdK | 8:422544d24df3 | 196 | } |
LvdK | 8:422544d24df3 | 197 | |
LvdK | 8:422544d24df3 | 198 | case 3: // BLT command, backlight control CDU |
LvdK | 8:422544d24df3 | 199 | { |
LvdK | 8:422544d24df3 | 200 | // Get backlight status: |
LvdK | 8:422544d24df3 | 201 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
LvdK | 8:422544d24df3 | 202 | if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') |
LvdK | 8:422544d24df3 | 203 | { CDU_STATUS.backlight = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 204 | CDU_Status_Update = 1; |
LvdK | 8:422544d24df3 | 205 | } |
LvdK | 8:422544d24df3 | 206 | break; |
LvdK | 8:422544d24df3 | 207 | } |
LvdK | 8:422544d24df3 | 208 | |
LvdK | 8:422544d24df3 | 209 | case 4: // SBY command, standby control CDU |
LvdK | 8:422544d24df3 | 210 | { |
LvdK | 8:422544d24df3 | 211 | // Get standby status: |
LvdK | 8:422544d24df3 | 212 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
LvdK | 8:422544d24df3 | 213 | if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') |
LvdK | 8:422544d24df3 | 214 | { CDU_STATUS.stby_mode = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 215 | CDU_Status_Update = 1; |
LvdK | 8:422544d24df3 | 216 | } |
LvdK | 8:422544d24df3 | 217 | break; |
LvdK | 8:422544d24df3 | 218 | } |
LvdK | 8:422544d24df3 | 219 | |
LvdK | 8:422544d24df3 | 220 | case 5: // CLS command, CDU clear screen control |
LvdK | 8:422544d24df3 | 221 | { |
LvdK | 8:422544d24df3 | 222 | DO_CLR_SCREEN = 1; // : tell to clear the screen |
LvdK | 8:422544d24df3 | 223 | break; |
LvdK | 8:422544d24df3 | 224 | } |
LvdK | 8:422544d24df3 | 225 | |
LvdK | 8:422544d24df3 | 226 | |
LvdK | 8:422544d24df3 | 227 | case 6: // SBC command, screen background colour control |
LvdK | 8:422544d24df3 | 228 | { |
LvdK | 8:422544d24df3 | 229 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
LvdK | 8:422544d24df3 | 230 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 231 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 232 | BACKGROUND_COL.BG_RED = colour; |
LvdK | 8:422544d24df3 | 233 | } |
LvdK | 8:422544d24df3 | 234 | char_pntr = comma[2] + 1; // : set char pointer to char after comma 2 |
LvdK | 8:422544d24df3 | 235 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 236 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 237 | BACKGROUND_COL.BG_GREEN = colour; |
LvdK | 8:422544d24df3 | 238 | } |
LvdK | 8:422544d24df3 | 239 | char_pntr = comma[3] + 1; // : set char pointer to char after comma 3 |
LvdK | 8:422544d24df3 | 240 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 241 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 242 | BACKGROUND_COL.BG_BLUE = colour; |
LvdK | 8:422544d24df3 | 243 | } |
LvdK | 8:422544d24df3 | 244 | |
LvdK | 8:422544d24df3 | 245 | Background_Col_Update = 1; // : set update of background colour |
LvdK | 8:422544d24df3 | 246 | break; |
LvdK | 8:422544d24df3 | 247 | } |
LvdK | 8:422544d24df3 | 248 | |
LvdK | 8:422544d24df3 | 249 | |
LvdK | 8:422544d24df3 | 250 | case 7: // WTX command, write textline to CDU screen |
LvdK | 8:422544d24df3 | 251 | { |
LvdK | 8:422544d24df3 | 252 | // Read linenumber: |
LvdK | 8:422544d24df3 | 253 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
LvdK | 8:422544d24df3 | 254 | line = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 255 | // Read char position: |
LvdK | 8:422544d24df3 | 256 | char_pntr = comma[2] + 1; // : set char pointer to char after comma 2 |
LvdK | 8:422544d24df3 | 257 | pos = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 258 | |
LvdK | 8:422544d24df3 | 259 | // Test if char X,Y position is within range: |
LvdK | 8:422544d24df3 | 260 | if ( line >= 1 && line <= max_lines && pos >= 1 && pos <= max_text0 ) |
LvdK | 8:422544d24df3 | 261 | { // Read font size : |
LvdK | 8:422544d24df3 | 262 | char_pntr = comma[3] + 1; // : set char pointer to char after comma 3 |
LvdK | 8:422544d24df3 | 263 | size = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 264 | // Test if size is valid: |
LvdK | 8:422544d24df3 | 265 | if ( size == 0 || size == 1 ) { |
LvdK | 8:422544d24df3 | 266 | TEXTLINE[line].font_size = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 267 | modified = true; |
LvdK | 8:422544d24df3 | 268 | } |
LvdK | 8:422544d24df3 | 269 | // Read line font style: |
LvdK | 8:422544d24df3 | 270 | char_pntr = comma[4] + 1; // : set char pointer to char after comma 4 |
LvdK | 8:422544d24df3 | 271 | ch = string_received[char_pntr]; |
LvdK | 8:422544d24df3 | 272 | // !! Font style check disabled: |
LvdK | 8:422544d24df3 | 273 | //if (ch == fstyle_1 || ch == fstyle_2 ) { |
LvdK | 8:422544d24df3 | 274 | TEXTLINE[line].font_style = ch; |
LvdK | 8:422544d24df3 | 275 | modified = true; |
LvdK | 8:422544d24df3 | 276 | //} |
LvdK | 8:422544d24df3 | 277 | // Read RGB line colour: |
LvdK | 8:422544d24df3 | 278 | char_pntr = comma[5] + 1; // : set char pointer to char after comma 5 |
LvdK | 8:422544d24df3 | 279 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 280 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 281 | TEXTLINE[line].text_RED = colour; |
LvdK | 8:422544d24df3 | 282 | modified = true; |
LvdK | 8:422544d24df3 | 283 | } |
LvdK | 8:422544d24df3 | 284 | char_pntr = comma[6] + 1; // : set char pointer to char after comma 6 |
LvdK | 8:422544d24df3 | 285 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 286 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 287 | TEXTLINE[line].text_GREEN = colour; |
LvdK | 8:422544d24df3 | 288 | modified = true; |
LvdK | 8:422544d24df3 | 289 | } |
LvdK | 8:422544d24df3 | 290 | char_pntr = comma[7] + 1; // : set char pointer to char after comma 7 |
LvdK | 8:422544d24df3 | 291 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 292 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 293 | TEXTLINE[line].text_BLUE = colour; |
LvdK | 8:422544d24df3 | 294 | modified = true; |
LvdK | 8:422544d24df3 | 295 | } |
LvdK | 8:422544d24df3 | 296 | // Read textfield : |
LvdK | 8:422544d24df3 | 297 | char_pntr = comma[8] + 1; // : set char pointer to first char of textfield |
LvdK | 8:422544d24df3 | 298 | last = 0; |
LvdK | 8:422544d24df3 | 299 | // read font size to determine last possible position: |
LvdK | 8:422544d24df3 | 300 | if ( TEXTLINE[line].font_size == 0 ) last = max_text0; |
LvdK | 8:422544d24df3 | 301 | else if ( TEXTLINE[line].font_size == 1 ) last = max_text1; |
LvdK | 8:422544d24df3 | 302 | |
LvdK | 8:422544d24df3 | 303 | if (last > 0 && pos <= last) { // : test for valid area and valid fontsize |
LvdK | 8:422544d24df3 | 304 | a = pos-1; // : !!!!!! |
LvdK | 8:422544d24df3 | 305 | while ( a <= last ) |
LvdK | 8:422544d24df3 | 306 | { ch = string_received[char_pntr]; |
LvdK | 8:422544d24df3 | 307 | if (ch == '*') break; // : do not include * in text |
LvdK | 8:422544d24df3 | 308 | TEXTLINE[line].text[a] = ch; |
LvdK | 8:422544d24df3 | 309 | a++; |
LvdK | 8:422544d24df3 | 310 | char_pntr++; |
LvdK | 8:422544d24df3 | 311 | } |
LvdK | 8:422544d24df3 | 312 | modified = true; |
LvdK | 8:422544d24df3 | 313 | TEXTLINE[line].text[a] = '\0'; // : mark end of text |
LvdK | 8:422544d24df3 | 314 | } |
LvdK | 8:422544d24df3 | 315 | } |
LvdK | 8:422544d24df3 | 316 | |
LvdK | 8:422544d24df3 | 317 | if ( modified == true ) { |
LvdK | 8:422544d24df3 | 318 | Text_Line_Update = line; // : set update of text line |
LvdK | 8:422544d24df3 | 319 | } |
LvdK | 8:422544d24df3 | 320 | |
LvdK | 8:422544d24df3 | 321 | // --------------- Debug only ----------------------------------------------------------------------- |
LvdK | 8:422544d24df3 | 322 | //SERIAL_DEBUG.printf("\rWTX command received :\r\n"); |
LvdK | 8:422544d24df3 | 323 | //SERIAL_DEBUG.printf("WTX line : %d\r\n",line ); // show line nr |
LvdK | 8:422544d24df3 | 324 | //SERIAL_DEBUG.printf("WTX begin pos : %d\r\n",pos ); // show begin position |
LvdK | 8:422544d24df3 | 325 | //SERIAL_DEBUG.printf("WTX fontsize is : %d\r\n",TEXTLINE[line].font_size ); // show fontsize |
LvdK | 8:422544d24df3 | 326 | //SERIAL_DEBUG.printf("WTX fontstyle is: %c\r\n",TEXTLINE[line].font_style); // show fontstyle |
LvdK | 8:422544d24df3 | 327 | //SERIAL_DEBUG.printf("WTX R_colour is : %d\r\n",TEXTLINE[line].text_RED ); // show textcolour |
LvdK | 8:422544d24df3 | 328 | //SERIAL_DEBUG.printf("WTX G_colour is : %d\r\n",TEXTLINE[line].text_GREEN ); // show textcolour |
LvdK | 8:422544d24df3 | 329 | //SERIAL_DEBUG.printf("WTX B_colour is : %d\r\n",TEXTLINE[line].text_BLUE ); // show textcolour |
LvdK | 8:422544d24df3 | 330 | //SERIAL_DEBUG.printf("WTX line text is: \r\n" ); |
LvdK | 8:422544d24df3 | 331 | //SERIAL_DEBUG.printf("%s\r\n",TEXTLINE[line].text ); // show line text |
LvdK | 8:422544d24df3 | 332 | //---------------------------------------------------------------------------------------------------- |
LvdK | 8:422544d24df3 | 333 | |
LvdK | 8:422544d24df3 | 334 | break; |
LvdK | 8:422544d24df3 | 335 | } |
LvdK | 8:422544d24df3 | 336 | |
LvdK | 8:422544d24df3 | 337 | case 8: // ETX command, erase (part of) textline of CDU screen |
LvdK | 8:422544d24df3 | 338 | { |
LvdK | 8:422544d24df3 | 339 | // Read linenumber: |
LvdK | 8:422544d24df3 | 340 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
LvdK | 8:422544d24df3 | 341 | line = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 342 | // Read char position: |
LvdK | 8:422544d24df3 | 343 | char_pntr = comma[2] + 1; // : set char pointer to char after comma 2 |
LvdK | 8:422544d24df3 | 344 | pos = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 345 | // Read nr of char to be erased: |
LvdK | 8:422544d24df3 | 346 | char_pntr = comma[3] + 1; // : set char pointer to char after comma 3 |
LvdK | 8:422544d24df3 | 347 | cnt = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 348 | // Test if char X,Y position is within range: |
LvdK | 8:422544d24df3 | 349 | if ( line >= 1 && line <= max_lines && pos >= 1 && pos <= max_text0 ) |
LvdK | 8:422544d24df3 | 350 | { |
LvdK | 8:422544d24df3 | 351 | last = 0; |
LvdK | 8:422544d24df3 | 352 | // read font size to determine last possible position: |
LvdK | 8:422544d24df3 | 353 | if ( TEXTLINE[line].font_size == 0 )last = max_text0; |
LvdK | 8:422544d24df3 | 354 | else if ( TEXTLINE[line].font_size == 1 )last = max_text1; |
LvdK | 8:422544d24df3 | 355 | |
LvdK | 8:422544d24df3 | 356 | if (last > 0 && pos <= last && cnt > 0) { // : test if in valid area and chars > 0 |
LvdK | 8:422544d24df3 | 357 | a = pos-1; //: !!!!!! |
LvdK | 8:422544d24df3 | 358 | modified = true; |
LvdK | 8:422544d24df3 | 359 | while ( a <= last && cnt > 0) |
LvdK | 8:422544d24df3 | 360 | { |
LvdK | 8:422544d24df3 | 361 | TEXTLINE[line].text[a] = ' '; //: write space |
LvdK | 8:422544d24df3 | 362 | a++; |
LvdK | 8:422544d24df3 | 363 | cnt--; |
LvdK | 8:422544d24df3 | 364 | } |
LvdK | 8:422544d24df3 | 365 | } |
LvdK | 8:422544d24df3 | 366 | } |
LvdK | 8:422544d24df3 | 367 | if ( modified == true ) { |
LvdK | 8:422544d24df3 | 368 | Text_Line_Update = line; // : set update of text line |
LvdK | 8:422544d24df3 | 369 | } |
LvdK | 8:422544d24df3 | 370 | |
LvdK | 8:422544d24df3 | 371 | // ---------------- Debug only ----------------------------------------------- |
LvdK | 8:422544d24df3 | 372 | //SERIAL_DEBUG.printf("ETX line : %d\r\n",line ); // show line nr |
LvdK | 8:422544d24df3 | 373 | //SERIAL_DEBUG.printf("ETX first erase pos : %d\r\n",pos ); // show begin pos |
LvdK | 8:422544d24df3 | 374 | //SERIAL_DEBUG.printf("ETX modified text line :\r\n" ); |
LvdK | 8:422544d24df3 | 375 | //SERIAL_DEBUG.printf("%s\r\n",TEXTLINE[line].text ); // show text line |
LvdK | 8:422544d24df3 | 376 | // --------------------------------------------------------------------------- |
LvdK | 8:422544d24df3 | 377 | |
LvdK | 8:422544d24df3 | 378 | break; |
LvdK | 8:422544d24df3 | 379 | } |
LvdK | 8:422544d24df3 | 380 | |
LvdK | 8:422544d24df3 | 381 | case 9: // KTX command, write textline to select key area |
LvdK | 8:422544d24df3 | 382 | { |
LvdK | 8:422544d24df3 | 383 | // Read key ID: |
LvdK | 8:422544d24df3 | 384 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
LvdK | 8:422544d24df3 | 385 | k_id = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 386 | |
LvdK | 8:422544d24df3 | 387 | // Read text type: |
LvdK | 8:422544d24df3 | 388 | char_pntr = comma[2] + 1; // : set char pointer to char after comma 2 |
LvdK | 8:422544d24df3 | 389 | ch = string_received[char_pntr]; |
LvdK | 8:422544d24df3 | 390 | |
LvdK | 8:422544d24df3 | 391 | if (ch == 'M' && k_id < max_keys ) // : text type = MAIN text and keyID valid |
LvdK | 8:422544d24df3 | 392 | { // Read font size : |
LvdK | 8:422544d24df3 | 393 | char_pntr = comma[3] + 1; // : set char pointer to char after comma 3 |
LvdK | 8:422544d24df3 | 394 | size = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 395 | // Test if size is valid: |
LvdK | 8:422544d24df3 | 396 | if ( size == 0 || size == 1 ) { |
LvdK | 8:422544d24df3 | 397 | SELKEY_MAINTEXT[k_id].font_size = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 398 | modified = true; |
LvdK | 8:422544d24df3 | 399 | } |
LvdK | 8:422544d24df3 | 400 | // Read line font style: |
LvdK | 8:422544d24df3 | 401 | char_pntr = comma[4] + 1; // : set char pointer to char after comma 4 |
LvdK | 8:422544d24df3 | 402 | ch = string_received[char_pntr]; |
LvdK | 8:422544d24df3 | 403 | // !! Font style check disabled: |
LvdK | 8:422544d24df3 | 404 | //if (ch == fstyle_1 || ch == fstyle_2 ) { |
LvdK | 8:422544d24df3 | 405 | SELKEY_MAINTEXT[k_id].font_style = ch; |
LvdK | 8:422544d24df3 | 406 | modified = true; |
LvdK | 8:422544d24df3 | 407 | //} |
LvdK | 8:422544d24df3 | 408 | // Read RGB line colour: |
LvdK | 8:422544d24df3 | 409 | char_pntr = comma[5] + 1; // : set char pointer to char after comma 5 |
LvdK | 8:422544d24df3 | 410 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 411 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 412 | SELKEY_MAINTEXT[k_id].text_RED = colour; |
LvdK | 8:422544d24df3 | 413 | modified = true; |
LvdK | 8:422544d24df3 | 414 | } |
LvdK | 8:422544d24df3 | 415 | char_pntr = comma[6] + 1; // : set char pointer to char after comma 5 |
LvdK | 8:422544d24df3 | 416 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 417 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 418 | SELKEY_MAINTEXT[k_id].text_GREEN = colour; |
LvdK | 8:422544d24df3 | 419 | modified = true; |
LvdK | 8:422544d24df3 | 420 | } |
LvdK | 8:422544d24df3 | 421 | char_pntr = comma[7] + 1; // : set char pointer to char after comma 7 |
LvdK | 8:422544d24df3 | 422 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 423 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 424 | SELKEY_MAINTEXT[k_id].text_BLUE = colour; |
LvdK | 8:422544d24df3 | 425 | modified = true; |
LvdK | 8:422544d24df3 | 426 | } |
LvdK | 8:422544d24df3 | 427 | // Read textfield : |
LvdK | 8:422544d24df3 | 428 | char_pntr = comma[8] + 1; // : set char pointer to first char of textfield |
LvdK | 8:422544d24df3 | 429 | last = 0; |
LvdK | 8:422544d24df3 | 430 | // read font size to determine last possible position: |
LvdK | 8:422544d24df3 | 431 | if ( SELKEY_MAINTEXT[k_id].font_size == 0 )last = max_text0; |
LvdK | 8:422544d24df3 | 432 | else if ( SELKEY_MAINTEXT[k_id].font_size == 1 )last = max_text1; |
LvdK | 8:422544d24df3 | 433 | |
LvdK | 8:422544d24df3 | 434 | if (last > 0) { // : test on valid fontsize |
LvdK | 8:422544d24df3 | 435 | a = 0; // : !!! pos 0 !! |
LvdK | 8:422544d24df3 | 436 | modified = true; |
LvdK | 8:422544d24df3 | 437 | while ( a <= last ) |
LvdK | 8:422544d24df3 | 438 | { ch = string_received[char_pntr]; |
LvdK | 8:422544d24df3 | 439 | if (ch == '*') break; // : do not include * in text |
LvdK | 8:422544d24df3 | 440 | SELKEY_MAINTEXT[k_id].text[a] = ch; |
LvdK | 8:422544d24df3 | 441 | a++; |
LvdK | 8:422544d24df3 | 442 | char_pntr++; |
LvdK | 8:422544d24df3 | 443 | } |
LvdK | 8:422544d24df3 | 444 | SELKEY_MAINTEXT[k_id].text[a] = '\0'; // : mark end of text |
LvdK | 8:422544d24df3 | 445 | } |
LvdK | 8:422544d24df3 | 446 | |
LvdK | 8:422544d24df3 | 447 | if ( modified == true ) { |
LvdK | 8:422544d24df3 | 448 | Key_Maintext_Update = k_id; // : set keynumber whose main text was updated |
LvdK | 8:422544d24df3 | 449 | |
LvdK | 8:422544d24df3 | 450 | } |
LvdK | 8:422544d24df3 | 451 | |
LvdK | 8:422544d24df3 | 452 | // ----------------------- Debug only ----------------------------------------------------------------- |
LvdK | 8:422544d24df3 | 453 | //SERIAL_DEBUG.printf("KTX decoded key nr is : %d\r\n\n",k_id ); // show key nr |
LvdK | 8:422544d24df3 | 454 | //SERIAL_DEBUG.printf("KTX MAINTEXT is : %s\r\n",SELKEY_MAINTEXT[k_id].text ); // show text |
LvdK | 8:422544d24df3 | 455 | //SERIAL_DEBUG.printf("KTX fontsize is : %d\r\n",SELKEY_MAINTEXT[k_id].font_size ); // show fontsize |
LvdK | 8:422544d24df3 | 456 | //SERIAL_DEBUG.printf("KTX fontstyle is: %c\r\n",SELKEY_MAINTEXT[k_id].font_style); // show fontstyle |
LvdK | 8:422544d24df3 | 457 | //SERIAL_DEBUG.printf("KTX R_colour is : %d\r\n",SELKEY_MAINTEXT[k_id].text_RED ); // show textcolour |
LvdK | 8:422544d24df3 | 458 | //SERIAL_DEBUG.printf("KTX G_colour is : %d\r\n",SELKEY_MAINTEXT[k_id].text_GREEN ); // show textcolour |
LvdK | 8:422544d24df3 | 459 | //SERIAL_DEBUG.printf("KTX B_colour is : %d\r\n",SELKEY_MAINTEXT[k_id].text_BLUE ); // show textcolour |
LvdK | 8:422544d24df3 | 460 | //---------------------------------------------------------------------------------------------------- |
LvdK | 8:422544d24df3 | 461 | } |
LvdK | 8:422544d24df3 | 462 | |
LvdK | 8:422544d24df3 | 463 | else if ( ch == 'S' && k_id < max_keys ) // : text type = SUB text and keyID valid |
LvdK | 8:422544d24df3 | 464 | { // Read font size 0 - 9: |
LvdK | 8:422544d24df3 | 465 | char_pntr = comma[3] + 1; // : set char pointer to char after comma 3 |
LvdK | 8:422544d24df3 | 466 | size = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 467 | // Test if size is valid: |
LvdK | 8:422544d24df3 | 468 | if ( size == 0 || size == 1 ) { |
LvdK | 8:422544d24df3 | 469 | SELKEY_SUBTEXT[k_id].font_size = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 470 | modified = true; |
LvdK | 8:422544d24df3 | 471 | } |
LvdK | 8:422544d24df3 | 472 | // Read line font style: |
LvdK | 8:422544d24df3 | 473 | char_pntr = comma[4] + 1; // : set char pointer to char after comma 4 |
LvdK | 8:422544d24df3 | 474 | ch = string_received[char_pntr]; |
LvdK | 8:422544d24df3 | 475 | if (ch == fstyle_1 || ch == fstyle_2 ) { |
LvdK | 8:422544d24df3 | 476 | SELKEY_SUBTEXT[k_id].font_style = ch; |
LvdK | 8:422544d24df3 | 477 | modified = true; |
LvdK | 8:422544d24df3 | 478 | } |
LvdK | 8:422544d24df3 | 479 | // Read RGB line colour: |
LvdK | 8:422544d24df3 | 480 | char_pntr = comma[5] + 1; // : set char pointer to char after comma 5 |
LvdK | 8:422544d24df3 | 481 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 482 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 483 | SELKEY_SUBTEXT[k_id].text_RED = colour; |
LvdK | 8:422544d24df3 | 484 | modified = true; |
LvdK | 8:422544d24df3 | 485 | } |
LvdK | 8:422544d24df3 | 486 | char_pntr = comma[6] + 1; // : set char pointer to char after comma 6 |
LvdK | 8:422544d24df3 | 487 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 488 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 489 | SELKEY_SUBTEXT[k_id].text_GREEN = colour; |
LvdK | 8:422544d24df3 | 490 | modified = true; |
LvdK | 8:422544d24df3 | 491 | } |
LvdK | 8:422544d24df3 | 492 | char_pntr = comma[7] + 1; // : set char pointer to char after comma 7 |
LvdK | 8:422544d24df3 | 493 | colour = atoi(&string_received[char_pntr]); |
LvdK | 8:422544d24df3 | 494 | if ( colour >= 0 && colour <= max_col_nr ) { |
LvdK | 8:422544d24df3 | 495 | SELKEY_SUBTEXT[k_id].text_BLUE = colour; |
LvdK | 8:422544d24df3 | 496 | modified = true; |
LvdK | 8:422544d24df3 | 497 | } |
LvdK | 8:422544d24df3 | 498 | // Read textfield : |
LvdK | 8:422544d24df3 | 499 | char_pntr = comma[8] + 1; // : set char pointer to first char of textfield |
LvdK | 8:422544d24df3 | 500 | last = 0; |
LvdK | 8:422544d24df3 | 501 | // read font size to determine last possible position: |
LvdK | 8:422544d24df3 | 502 | if ( SELKEY_SUBTEXT[k_id].font_size == 0 )last = max_text0; |
LvdK | 8:422544d24df3 | 503 | else if ( SELKEY_SUBTEXT[k_id].font_size == 1 )last = max_text1; |
LvdK | 8:422544d24df3 | 504 | |
LvdK | 8:422544d24df3 | 505 | if (last > 0) { // : test on valid fontsize |
LvdK | 8:422544d24df3 | 506 | a = 0; // : !!! pos 0 !! |
LvdK | 8:422544d24df3 | 507 | modified = true; |
LvdK | 8:422544d24df3 | 508 | while ( a <= last ) |
LvdK | 8:422544d24df3 | 509 | { ch = string_received[char_pntr]; |
LvdK | 8:422544d24df3 | 510 | if (ch == '*') break; // : do not include * in text |
LvdK | 8:422544d24df3 | 511 | SELKEY_SUBTEXT[k_id].text[a] = ch; |
LvdK | 8:422544d24df3 | 512 | a++; |
LvdK | 8:422544d24df3 | 513 | char_pntr++; |
LvdK | 8:422544d24df3 | 514 | } |
LvdK | 8:422544d24df3 | 515 | SELKEY_SUBTEXT[k_id].text[a] = '\0'; // : mark end of text |
LvdK | 8:422544d24df3 | 516 | } |
LvdK | 8:422544d24df3 | 517 | |
LvdK | 8:422544d24df3 | 518 | if ( modified == true ) { |
LvdK | 8:422544d24df3 | 519 | Key_Subtext_Update = k_id; // : set keynumber whose sub text was updated |
LvdK | 8:422544d24df3 | 520 | } |
LvdK | 8:422544d24df3 | 521 | |
LvdK | 8:422544d24df3 | 522 | // ------------------ Debug only ---------------------------------------------------------- |
LvdK | 8:422544d24df3 | 523 | //SERIAL_DEBUG.printf("KTX key nr is : %d\r\n",k_id ); // show key nr |
LvdK | 8:422544d24df3 | 524 | //SERIAL_DEBUG.printf("KTX SUBTEXT is : %s\r\n",SELKEY_SUBTEXT[k_id].text ); // show text |
LvdK | 8:422544d24df3 | 525 | //SERIAL_DEBUG.printf("KTX fontsize is : %d\r\n",SELKEY_SUBTEXT[k_id].font_size ); // show fontsize |
LvdK | 8:422544d24df3 | 526 | //SERIAL_DEBUG.printf("KTX fontstyle is: %c\r\n",SELKEY_SUBTEXT[k_id].font_style); // show fontstyle |
LvdK | 8:422544d24df3 | 527 | //SERIAL_DEBUG.printf("KTX R_colour is : %d\r\n",SELKEY_SUBTEXT[k_id].text_RED ); // show textcolour |
LvdK | 8:422544d24df3 | 528 | //SERIAL_DEBUG.printf("KTX G_colour is : %d\r\n",SELKEY_SUBTEXT[k_id].text_GREEN ); // show textcolour |
LvdK | 8:422544d24df3 | 529 | //SERIAL_DEBUG.printf("KTX B_colour is : %d\r\n",SELKEY_SUBTEXT[k_id].text_BLUE ); // show textcolour |
LvdK | 8:422544d24df3 | 530 | // ----------------------------------------------------------------------------------------- |
LvdK | 8:422544d24df3 | 531 | } |
LvdK | 8:422544d24df3 | 532 | break; |
LvdK | 8:422544d24df3 | 533 | } |
LvdK | 8:422544d24df3 | 534 | |
WillemBraat | 10:7e350a27f936 | 535 | case 10: // FAI command, FAIL indicator control CDU |
WillemBraat | 10:7e350a27f936 | 536 | { |
WillemBraat | 10:7e350a27f936 | 537 | // Get message indicator status: |
WillemBraat | 10:7e350a27f936 | 538 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
WillemBraat | 10:7e350a27f936 | 539 | if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') |
WillemBraat | 10:7e350a27f936 | 540 | { CDU_STATUS.fail_indicator = atoi(&string_received[char_pntr]); |
WillemBraat | 10:7e350a27f936 | 541 | CDU_Status_Update = 1; |
WillemBraat | 10:7e350a27f936 | 542 | } |
WillemBraat | 10:7e350a27f936 | 543 | break; |
WillemBraat | 10:7e350a27f936 | 544 | } |
WillemBraat | 10:7e350a27f936 | 545 | |
WillemBraat | 10:7e350a27f936 | 546 | case 11: // DPY command, DISPLAY indicator control CDU |
WillemBraat | 10:7e350a27f936 | 547 | { |
WillemBraat | 10:7e350a27f936 | 548 | // Get message indicator status: |
WillemBraat | 10:7e350a27f936 | 549 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
WillemBraat | 10:7e350a27f936 | 550 | if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') |
WillemBraat | 10:7e350a27f936 | 551 | { CDU_STATUS.dspy_indicator = atoi(&string_received[char_pntr]); |
WillemBraat | 10:7e350a27f936 | 552 | CDU_Status_Update = 1; |
WillemBraat | 10:7e350a27f936 | 553 | } |
WillemBraat | 10:7e350a27f936 | 554 | break; |
WillemBraat | 10:7e350a27f936 | 555 | } |
WillemBraat | 10:7e350a27f936 | 556 | |
WillemBraat | 10:7e350a27f936 | 557 | case 12: // OFS command, OFFSET indicator control CDU |
WillemBraat | 10:7e350a27f936 | 558 | { |
WillemBraat | 10:7e350a27f936 | 559 | // Get message indicator status: |
WillemBraat | 10:7e350a27f936 | 560 | char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 |
WillemBraat | 10:7e350a27f936 | 561 | if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') |
WillemBraat | 10:7e350a27f936 | 562 | { CDU_STATUS.ofst_indicator = atoi(&string_received[char_pntr]); |
WillemBraat | 10:7e350a27f936 | 563 | CDU_Status_Update = 1; |
WillemBraat | 10:7e350a27f936 | 564 | } |
WillemBraat | 10:7e350a27f936 | 565 | break; |
WillemBraat | 10:7e350a27f936 | 566 | } |
WillemBraat | 10:7e350a27f936 | 567 | |
LvdK | 8:422544d24df3 | 568 | default: |
LvdK | 8:422544d24df3 | 569 | { |
LvdK | 8:422544d24df3 | 570 | // unknown commandnumber ! |
LvdK | 8:422544d24df3 | 571 | break; |
LvdK | 8:422544d24df3 | 572 | } |
LvdK | 8:422544d24df3 | 573 | |
LvdK | 8:422544d24df3 | 574 | } |
LvdK | 8:422544d24df3 | 575 | |
LvdK | 8:422544d24df3 | 576 | CDU_OS.SetEvent(FS_DATA_EVENT,CDU_DSP_CSS_TASK_ID); // : set event for CDU screen update task |
LvdK | 8:422544d24df3 | 577 | } |