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 Engravity-CDU

show_data.cpp

Committer:
WillemBraat
Date:
2014-07-21
Revision:
11:d60c746c097c
Parent:
8:422544d24df3

File content as of revision 11:d60c746c097c:

// L. van der Kolk, ELVEDEKA, Holland //
// File:  show_data.cpp 

// -----  FOR DEBUG ONLY ----------------------------
// - Functions to test received and updated CDU data
// --------------------------------------------------

#include "mbed.h"
#include "MODSERIAL.h"
#include "mbos.h"
#include "mbos_def2.h"
#include "FS_datastructures.h"

extern mbos CDU_OS; 
extern MODSERIAL SERIAL_DEBUG;
extern int FSdata_received_flag;

int step_counter = 0;

void test_update_flags()
{
// Test if DCU data was updated:
    
// Background_Col_Update  : 1 when color was updated, must be reset to 0 when data has been read
// CDU_Status_Update      : 1 when status was updated, must be reset to 0 when data has been read
// DO_CLR_SCREEN          : 1 when screen should be cleared, must be reset to 0 when done
// Text_Line_Update       : equal to line number whose text was updated, must be reset to 0 when text has been read 
// Key_Maintext_Update    : equal to keynumber whose main text line was updated, must be reset to -1 text has been read
// Key_Subtext_Update     : equal to keynumber whose sub text line was updated, must be reset to -1 text has been read
  
  if ( Text_Line_Update != 0 ) {  //: textline was updated !
          // read textline data and print:
          SERIAL_DEBUG.printf("\r show data read from datastructure:\r\n");          
          SERIAL_DEBUG.printf("line        : %d\r\n",Text_Line_Update );                         // show line nr 
          //SERIAL_DEBUG.printf("WTX begin pos   : %d\r\n",pos );                          // show begin position   
          SERIAL_DEBUG.printf("fontsize is : %d\r\n",TEXTLINE[Text_Line_Update].font_size );     // show fontsize 
          SERIAL_DEBUG.printf("fontstyle is: %c\r\n",TEXTLINE[Text_Line_Update].font_style);     // show fontstyle 
          SERIAL_DEBUG.printf("R_colour is : %d\r\n",TEXTLINE[Text_Line_Update].text_RED );      // show textcolour 
          SERIAL_DEBUG.printf("G_colour is : %d\r\n",TEXTLINE[Text_Line_Update].text_GREEN );    // show textcolour 
          SERIAL_DEBUG.printf("B_colour is : %d\r\n",TEXTLINE[Text_Line_Update].text_BLUE );     // show textcolour 
          SERIAL_DEBUG.printf("line text is: \r\n" );           
          SERIAL_DEBUG.printf("%s\r\n",TEXTLINE[Text_Line_Update].text );    // show line text
          
          Text_Line_Update = 0;  // : reset FS data update ID flag
     }
        
    if ( Background_Col_Update != 0 ) {  // : background colour was updated
          // read new colour data and print: 
          SERIAL_DEBUG.printf("\r show data read from datastructure:\r\n");
          SERIAL_DEBUG.printf("background R_colour : %d\r\n",BACKGROUND_COL.BG_RED);
          SERIAL_DEBUG.printf("background G_colour : %d\r\n",BACKGROUND_COL.BG_GREEN);
          SERIAL_DEBUG.printf("background B_colour : %d\r\n",BACKGROUND_COL.BG_BLUE);
          
          Background_Col_Update = 0;  // : reset FS data update ID flag       
    }            

    if ( CDU_Status_Update != 0 ) { // : CDU status was updated
         // read new status data and print: 
          SERIAL_DEBUG.printf("\r show data read from datastructure:\r\n" );
          SERIAL_DEBUG.printf("Message indicator is : %d \r\n", CDU_STATUS.msg_indicator);
          SERIAL_DEBUG.printf("EXEC indicator is : %d \r\n", CDU_STATUS.exec_indicator);
          SERIAL_DEBUG.printf("Backlight is : %d \r\n", CDU_STATUS.backlight); 
          SERIAL_DEBUG.printf("Standby mode is : %d \r\n", CDU_STATUS.stby_mode);
          
          CDU_Status_Update = 0;   // : reset FS data update ID flag
     }
        
     if ( DO_CLR_SCREEN != 0 ) {   // : clr screen request received
          SERIAL_DEBUG.printf("\r\r CLR screen request read:\r\n" );
          SERIAL_DEBUG.printf("DO_CLR_CSCREEN : %d \r\n", DO_CLR_SCREEN );
          
           DO_CLR_SCREEN = 0;
     }
     
     if (Key_Maintext_Update > -1) {  // : key maintext was updated
                             
          SERIAL_DEBUG.printf("\r show data read from datastructure:\r\n"); 
          //SERIAL_DEBUG.printf("Key number is : %d\r\n",Key_Maintext_Update);
                      
         SERIAL_DEBUG.printf("Key MAINTEXT is : %s\r\n",SELKEY_MAINTEXT[50].text );      // show text
         SERIAL_DEBUG.printf("Key MAINTEXT is : %s\r\n",SELKEY_MAINTEXT[51].text );       // show text
         SERIAL_DEBUG.printf("Key MAINTEXT is : %s\r\n",SELKEY_MAINTEXT[52].text );       // show text 
         
          //SERIAL_DEBUG.printf("Keyfontsize is : %d\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].font_size );  // show fontsize 
          //SERIAL_DEBUG.printf("Key fontstyle is: %c\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].font_style);  // show fontstyle 
          //SERIAL_DEBUG.printf("Key R_colour is : %d\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].text_RED );   // show textcolour 
          //SERIAL_DEBUG.printf("Key G_colour is : %d\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].text_GREEN ); // show textcolour 
          //SERIAL_DEBUG.printf("Key B_colour is : %d\r\n",SELKEY_MAINTEXT[Key_Maintext_Update].text_BLUE );  // show textcolour 
          
          Key_Maintext_Update = -1; 
          
          step_counter=5;
          SERIAL_DEBUG.printf("step_counter: %d\r\n", step_counter );  //  debug 
         
     }
     
     if (Key_Subtext_Update > -1) {  // : key subtext was updated
     
          SERIAL_DEBUG.printf("\r show data read from datastructure:\r\n"); 
          SERIAL_DEBUG.printf("Key number is : %d\r\n",Key_Subtext_Update);                            
          SERIAL_DEBUG.printf("Key SUBTEXT is  : %s\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].text );       // show text  
          SERIAL_DEBUG.printf("Key fontsize is : %d\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].font_size );  // show fontsize 
          SERIAL_DEBUG.printf("Key fontstyle is: %c\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].font_style);  // show fontstyle 
          SERIAL_DEBUG.printf("Key R_colour is : %d\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].text_RED );   // show textcolour 
          SERIAL_DEBUG.printf("Key G_colour is : %d\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].text_GREEN ); // show textcolour 
          SERIAL_DEBUG.printf("Key B_colour is : %d\r\n",SELKEY_SUBTEXT[Key_Subtext_Update].text_BLUE );  // show textcolour     
          
          Key_Subtext_Update = -1;
         
     }
          
     FSdata_received_flag = false; // : reset commomn FS data update flag
     step_counter = 10;
     SERIAL_DEBUG.printf("step_counter: %d\r\n", step_counter );  //  debug 
     
}