Skip to content

Commit 378f6d6

Browse files
author
Wegmann Peter
committed
added better communication of startup errors
1 parent e04cdac commit 378f6d6

File tree

8 files changed

+293
-122
lines changed

8 files changed

+293
-122
lines changed

DispAdapter.c

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#ifdef GCM_old_disp
2727

2828
#include "disp/gcm_old_lcd_driver.h"
29+
#include "StringPixelCoordTabble_old.h"
2930
#endif
3031

3132
#ifdef ili9341
@@ -499,7 +500,7 @@ void displayTemPreVol(void){
499500

500501

501502

502-
503+
503504

504505

505506

@@ -814,4 +815,99 @@ void paint_Date(void){
814815
sprintf(strBuff,"%02i.%02i.%04i ", Time.tm_mday,Time.tm_mon,Time.tm_year+2000);
815816
paint_string_row_col(strBuff,DATETIME,0,FGC);
816817

818+
}
819+
820+
//yes no dialog for Landscape
821+
//output a message with title and text
822+
//at last function waits for keypress
823+
void ErrMessage(char *title, char *text, unsigned int BackColor, unsigned int ForeColor) {
824+
#ifdef ili9341
825+
826+
uint8_t x0,x,y,i,len;
827+
828+
lcd_Cls(BackColor);
829+
830+
char temp[2];
831+
temp[1] = '\0';
832+
833+
lcd_Box(20,70,220,300,ForeColor);
834+
LCD_Print(title,120-(strlen(title)*FONT2_W/2),30,2,1,1,ForeColor,BackColor);
835+
x0 = 22;
836+
837+
//for Landscape only
838+
x = x0;
839+
y = 75;
840+
841+
842+
len = strlen(text);
843+
for(i=0;i<len;i++) {
844+
if(text[i] != '\n')
845+
{
846+
temp[0] = text[i];
847+
LCD_Print(temp,x,y,1,1,1,BackColor,ForeColor);
848+
x += CHAR_CELL_WIDTH_FONT_1;
849+
if(x >= 210)
850+
{
851+
if(y>=250)
852+
break;
853+
y += FONT1_H;
854+
x = x0;
855+
continue;
856+
}
857+
}
858+
else {
859+
if(y >= 250)
860+
break;
861+
y += FONT1_H;
862+
x = x0;
863+
continue;
864+
}
865+
}
866+
867+
_delay_ms(4000);
868+
869+
#endif
870+
#ifdef GCM_old_disp
871+
uint8_t x0,x,y,i,len;
872+
873+
lcd_Cls(BGC);
874+
LCD_String(title,0,0);
875+
876+
len = strlen(text);
877+
878+
char temp[2];
879+
temp[1] = '\0';
880+
881+
x0 = 0;
882+
x = 0;
883+
884+
y = 1;
885+
for(i=0;i<len;i++) {
886+
if(text[i] != '\n')
887+
{
888+
temp[0] = text[i];
889+
LCD_String(temp,x,y);
890+
x ++;
891+
if(x >= 12)
892+
{
893+
if(y>=6)
894+
break;
895+
y ++;
896+
x = x0;
897+
continue;
898+
}
899+
}
900+
else {
901+
if(y >= 5)
902+
break;
903+
y ++;
904+
x = x0;
905+
continue;
906+
}
907+
}
908+
909+
_delay_ms(4000);
910+
911+
912+
#endif
817913
}

DispAdapter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,6 @@ void displayTemPreVol(void);
9595
void reset_display(uint8_t clear);
9696
void I2C_Clear_view(uint8_t i2cState,uint8_t DS3231State, uint8_t BMPSate);
9797
void paint_Date(void);
98+
void ErrMessage(char *title, char *text, unsigned int BackColor, unsigned int ForeColor);
9899

99100
#endif /* DISPADAPTER_H_ */

0 commit comments

Comments
 (0)