Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetNetIf NTPClient_NetServices mbed ConfigFile
display.c
00001 /************************************************************* 00002 00003 display.c 00004 00005 *************************************************************/ 00006 #include "mbed.h" 00007 #include "TextLCD.h" 00008 #include "GPS.h" 00009 #include "NTPClient.h" 00010 00011 extern void calculate_sv(); 00012 extern float cpm; 00013 extern float uSv; 00014 extern int LCD_writing; 00015 extern GPS* gps; 00016 extern TextLCD lcd; 00017 extern NTPResult ntpRet; 00018 extern time_t tz_offset; 00019 00020 void debug_print() 00021 { 00022 00023 calculate_sv(); 00024 #ifdef DEBUG 00025 printf("cpm=%3.2f, %3.2fuSv/h\r\n",cpm,uSv); 00026 for(int i=0;i<first_touch_index;i++){ 00027 printf("[%d]=%f\r\n",i,cpm_array[i]); 00028 } 00029 printf("first_touch_index=%d\r\n",first_touch_index); 00030 printf("cpm_index=%d\r\n",cpm_index); 00031 #endif 00032 } 00033 00034 /************************************** 00035 * calendar hyoji 00036 ***************************************/ 00037 void calendarHyoji(char *msg){ 00038 time_t ctTime; 00039 struct tm *jst_time; 00040 char tmp[100] = "\0"; 00041 00042 ctTime = time(NULL); 00043 ctTime += tz_offset; 00044 jst_time = localtime(&ctTime); 00045 00046 sprintf(tmp,"%4d/%02d/%02d %02d:%02d", 00047 jst_time->tm_year+1900, 00048 (jst_time->tm_mon + 1), 00049 jst_time->tm_mday, 00050 jst_time->tm_hour, 00051 jst_time->tm_min); 00052 strcat(msg, tmp); 00053 } 00054 /************************************** 00055 * fullcalendar hyoji 00056 ***************************************/ 00057 void fullcalendarHyoji(char *msg){ 00058 time_t ctTime; 00059 struct tm *jst_time; 00060 char tmp[100]; 00061 tmp[0] = '\0'; 00062 00063 ctTime = time(NULL); 00064 ctTime += tz_offset; 00065 jst_time = localtime(&ctTime); 00066 00067 sprintf(tmp,"%4d/%02d/%02d,%02d:%02d:%02d,",jst_time->tm_year+1900,(jst_time->tm_mon + 1),jst_time->tm_mday, jst_time->tm_hour, jst_time->tm_min, jst_time->tm_sec); 00068 strcat(msg, tmp); 00069 } 00070 00071 void LCD_out_sub(){ 00072 calculate_sv(); 00073 lcd.printf("\n%3dcpm/",((int)cpm < 1000 ? (int)cpm : 999)); 00074 if (uSv < 10.0) { 00075 lcd.printf("%.3fuSv",uSv); 00076 } else if (uSv < 100.0) { 00077 lcd.printf("%.2fuSv",uSv); 00078 } else { 00079 lcd.printf("%.2fuSv",99.99); 00080 } 00081 } 00082 00083 00084 /************************************** 00085 * LCD output kiokuchi wo LCD ni hyoji 00086 ***************************************/ 00087 void LCD_output(){ 00088 if(LCD_writing){ 00089 return; 00090 } 00091 LCD_writing=1; 00092 LCD_out_sub(); 00093 LCD_writing=0; 00094 } 00095 00096 00097 void LCD_time_and_output(){ 00098 char msg[256]; 00099 msg[0]='\0'; 00100 00101 if(LCD_writing){ 00102 return; 00103 } 00104 LCD_writing=1; 00105 lcd.cls(); 00106 lcd.locate(0,0); 00107 00108 if ( ntpRet == NTP_OK) { 00109 calendarHyoji(msg); 00110 } 00111 lcd.printf("%s",msg); 00112 lcd.locate(0,0); 00113 LCD_out_sub(); 00114 LCD_writing=0; 00115 } 00116 00117 void LCD_cpm_output() { 00118 if(LCD_writing){ 00119 return; 00120 } 00121 LCD_writing=1; 00122 lcd.cls(); 00123 lcd.locate(0,0); 00124 calculate_sv(); 00125 lcd.printf("GM check mode\n%.3fcpm",cpm); 00126 LCD_writing=0; 00127 } 00128 00129 void printable_msg(char* msg){ 00130 char tmp[256]; 00131 tmp[0]= '\0'; 00132 00133 if(gps->longitude!=0 && gps->latitude!=0) 00134 sprintf(msg,"%f,%f:",gps->longitude,gps->latitude); 00135 00136 calculate_sv(); 00137 00138 fullcalendarHyoji(tmp); 00139 strcat(msg,tmp); 00140 00141 strcat(msg," "); 00142 sprintf(tmp,"%d",(int)cpm); 00143 strcat(msg,tmp); 00144 strcat(msg,"cpm,"); 00145 sprintf(tmp,"%.3f",uSv); 00146 strcat(msg,tmp); 00147 strcat(msg,"uSv\n"); 00148 00149 } 00150
Generated on Tue Jul 12 2022 10:57:43 by
1.7.2