voor willem test

Dependencies:   4DGL MODSERIAL mbed mbos

Committer:
LvdK
Date:
Thu Jul 17 10:09:14 2014 +0000
Revision:
7:6576a287e563
CDU V21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
LvdK 7:6576a287e563 1 // L. van der Kolk, ELVEDEKA, Holland //
LvdK 7:6576a287e563 2 // File: show_data.cpp
LvdK 7:6576a287e563 3
LvdK 7:6576a287e563 4 // ----- Testing only --------------------------------------------
LvdK 7:6576a287e563 5 // - Functions to test received and updated CDU data
LvdK 7:6576a287e563 6
LvdK 7:6576a287e563 7
LvdK 7:6576a287e563 8 #include "mbed.h"
LvdK 7:6576a287e563 9 #include "MODSERIAL.h"
LvdK 7:6576a287e563 10 #include "mbos.h"
LvdK 7:6576a287e563 11 #include "mbos_def.h"
LvdK 7:6576a287e563 12 #include "FS_datastructures.h"
LvdK 7:6576a287e563 13
LvdK 7:6576a287e563 14 extern mbos CDU_OS;
LvdK 7:6576a287e563 15 extern MODSERIAL SERIAL_DEBUG;
LvdK 7:6576a287e563 16 static int command_cntr = 0;
LvdK 7:6576a287e563 17
LvdK 7:6576a287e563 18 void test_update_flags()
LvdK 7:6576a287e563 19 {
LvdK 7:6576a287e563 20 // Tset if DCU data was updated:
LvdK 7:6576a287e563 21
LvdK 7:6576a287e563 22 // Background_Col_Update : 1 when color was updated, must be reset to 0 when data has been read
LvdK 7:6576a287e563 23 // CDU_Status_Update : 1 when status was updated, must be reset to 0 when data has been read
LvdK 7:6576a287e563 24 // DO_CLR_SCREEN : 1 when screen should be cleared, must be reset to 0 when done
LvdK 7:6576a287e563 25 // Text_Line_Update : equal to line number whose text was updated, must be reset to 0 when text has been read
LvdK 7:6576a287e563 26 // Key_Maintext_Update : equal to keynumber whose main text line was updated, must be reset to -1 text has been read
LvdK 7:6576a287e563 27 // Key_Subtext_Update : equal to keynumber whose sub text line was updated, must be reset to -1 text has been read
LvdK 7:6576a287e563 28
LvdK 7:6576a287e563 29 if ( Text_Line_Update != 0 ) { //: textline was updated !
LvdK 7:6576a287e563 30 // read textline data and print:
LvdK 7:6576a287e563 31 SERIAL_DEBUG.printf("\rTextline updated:\r\n");
LvdK 7:6576a287e563 32 SERIAL_DEBUG.printf("line : %d\r\n",Text_Line_Update ); // show line nr
LvdK 7:6576a287e563 33 //SERIAL_DEBUG.printf("WTX begin pos : %d\r\n",pos ); // show begin position
LvdK 7:6576a287e563 34 SERIAL_DEBUG.printf("fontsize is : %d\r\n",TEXTLINE[Text_Line_Update].font_size ); // show fontsize
LvdK 7:6576a287e563 35 SERIAL_DEBUG.printf("fontstyle is: %c\r\n",TEXTLINE[Text_Line_Update].font_style); // show fontstyle
LvdK 7:6576a287e563 36 SERIAL_DEBUG.printf("R_colour is : %d\r\n",TEXTLINE[Text_Line_Update].text_RED ); // show textcolour
LvdK 7:6576a287e563 37 SERIAL_DEBUG.printf("G_colour is : %d\r\n",TEXTLINE[Text_Line_Update].text_GREEN ); // show textcolour
LvdK 7:6576a287e563 38 SERIAL_DEBUG.printf("B_colour is : %d\r\n",TEXTLINE[Text_Line_Update].text_BLUE ); // show textcolour
LvdK 7:6576a287e563 39 SERIAL_DEBUG.printf("line text is: \r\n" );
LvdK 7:6576a287e563 40 SERIAL_DEBUG.printf("%s\r\n",TEXTLINE[Text_Line_Update].text ); // show line text
LvdK 7:6576a287e563 41 command_cntr++;
LvdK 7:6576a287e563 42 SERIAL_DEBUG.printf("command count : %d\r\n",command_cntr ); // : show counter for debugging
LvdK 7:6576a287e563 43
LvdK 7:6576a287e563 44 }
LvdK 7:6576a287e563 45
LvdK 7:6576a287e563 46 if ( Background_Col_Update != 0 ) { // : background colour was updated
LvdK 7:6576a287e563 47 // read new colour data and print:
LvdK 7:6576a287e563 48 SERIAL_DEBUG.printf("\rSBC command received:\r\n");
LvdK 7:6576a287e563 49 SERIAL_DEBUG.printf("background R_colour : %d\r\n",BACKGROUND_COL.BG_RED);
LvdK 7:6576a287e563 50 SERIAL_DEBUG.printf("background G_colour : %d\r\n",BACKGROUND_COL.BG_GREEN);
LvdK 7:6576a287e563 51 SERIAL_DEBUG.printf("background B_colour : %d\r\n",BACKGROUND_COL.BG_BLUE);
LvdK 7:6576a287e563 52 command_cntr++;
LvdK 7:6576a287e563 53 SERIAL_DEBUG.printf("command count : %d\r\n",command_cntr ); // : show counter for debugging
LvdK 7:6576a287e563 54
LvdK 7:6576a287e563 55 }
LvdK 7:6576a287e563 56
LvdK 7:6576a287e563 57 if ( CDU_Status_Update != 0 ) { // : CDU status was updated
LvdK 7:6576a287e563 58 // read new status data and print:
LvdK 7:6576a287e563 59 SERIAL_DEBUG.printf("\r\r Setting command received :\r\n" );
LvdK 7:6576a287e563 60 SERIAL_DEBUG.printf("Message indicator is : %d \r\n", CDU_STATUS.msg_indicator);
LvdK 7:6576a287e563 61 SERIAL_DEBUG.printf("EXEC indicator is : %d \r\n", CDU_STATUS.exec_indicator);
LvdK 7:6576a287e563 62 SERIAL_DEBUG.printf("Backlight is : %d \r\n", CDU_STATUS.backlight);
LvdK 7:6576a287e563 63 SERIAL_DEBUG.printf("Standby mode is : %d \r\n", CDU_STATUS.stby_mode);
LvdK 7:6576a287e563 64 command_cntr++;
LvdK 7:6576a287e563 65 SERIAL_DEBUG.printf("command count : %d\r\n",command_cntr ); // : show counter for debugging
LvdK 7:6576a287e563 66
LvdK 7:6576a287e563 67 }
LvdK 7:6576a287e563 68
LvdK 7:6576a287e563 69 if ( DO_CLR_SCREEN != 0 ) { // : clr screen request received
LvdK 7:6576a287e563 70 SERIAL_DEBUG.printf("\r\r CLR screen request received :\r\n" );
LvdK 7:6576a287e563 71 SERIAL_DEBUG.printf("DO_CLR_CSCREEN : %d \r\n", DO_CLR_SCREEN );
LvdK 7:6576a287e563 72 command_cntr++;
LvdK 7:6576a287e563 73 SERIAL_DEBUG.printf("command count : %d\r\n",command_cntr ); // : show counter for debugging
LvdK 7:6576a287e563 74
LvdK 7:6576a287e563 75 }
LvdK 7:6576a287e563 76
LvdK 7:6576a287e563 77 if (Key_Maintext_Update >= 0) { // : key maintext was updated
LvdK 7:6576a287e563 78
LvdK 7:6576a287e563 79 SERIAL_DEBUG.printf("\rKey command received:\r\n");
LvdK 7:6576a287e563 80 SERIAL_DEBUG.printf("Key number is : %d\r\n",Key_Maintext_Update);
LvdK 7:6576a287e563 81 SERIAL_DEBUG.printf("Key MAINTEXT is : %s\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].text ); // show text
LvdK 7:6576a287e563 82 SERIAL_DEBUG.printf("Keyfontsize is : %d\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].font_size ); // show fontsize
LvdK 7:6576a287e563 83 SERIAL_DEBUG.printf("Key fontstyle is: %c\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].font_style); // show fontstyle
LvdK 7:6576a287e563 84 SERIAL_DEBUG.printf("Key R_colour is : %d\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].text_RED ); // show textcolour
LvdK 7:6576a287e563 85 SERIAL_DEBUG.printf("Key G_colour is : %d\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].text_GREEN ); // show textcolour
LvdK 7:6576a287e563 86 SERIAL_DEBUG.printf("Key B_colour is : %d\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].text_BLUE ); // show textcolour
LvdK 7:6576a287e563 87
LvdK 7:6576a287e563 88
LvdK 7:6576a287e563 89 }
LvdK 7:6576a287e563 90
LvdK 7:6576a287e563 91 if (Key_Subtext_Update >= 0) { // : key subtext was updated
LvdK 7:6576a287e563 92
LvdK 7:6576a287e563 93 SERIAL_DEBUG.printf("\rKey command received:\r\n");
LvdK 7:6576a287e563 94 SERIAL_DEBUG.printf("Key number is : %d\r\n",Key_Subtext_Update);
LvdK 7:6576a287e563 95 SERIAL_DEBUG.printf("Key SUBTEXT is : %s\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].text ); // show text
LvdK 7:6576a287e563 96 SERIAL_DEBUG.printf("Key fontsize is : %d\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].font_size ); // show fontsize
LvdK 7:6576a287e563 97 SERIAL_DEBUG.printf("Key fontstyle is: %c\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].font_style); // show fontstyle
LvdK 7:6576a287e563 98 SERIAL_DEBUG.printf("Key R_colour is : %d\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].text_RED ); // show textcolour
LvdK 7:6576a287e563 99 SERIAL_DEBUG.printf("Key G_colour is : %d\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].text_GREEN ); // show textcolour
LvdK 7:6576a287e563 100 SERIAL_DEBUG.printf("Key B_colour is : %d\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].text_BLUE ); // show textcolour
LvdK 7:6576a287e563 101
LvdK 7:6576a287e563 102
LvdK 7:6576a287e563 103 }
LvdK 7:6576a287e563 104
LvdK 7:6576a287e563 105 /* Text_Line_Update = 0; // : reset FS data update ID flag
LvdK 7:6576a287e563 106 Background_Col_Update = 0; // : reset FS data update ID flag
LvdK 7:6576a287e563 107 CDU_Status_Update = 0; // : reset FS data update ID flag
LvdK 7:6576a287e563 108 CDU_Status_Update = 0; // : reset FS data update ID flag
LvdK 7:6576a287e563 109 DO_CLR_SCREEN = 0;
LvdK 7:6576a287e563 110 Key_Maintext_Update = -1;
LvdK 7:6576a287e563 111 Key_Subtext_Update = -1;
LvdK 7:6576a287e563 112 */
LvdK 7:6576a287e563 113
LvdK 7:6576a287e563 114 }