Skip to content

Commit 9018390

Browse files
author
Wegmann Peter
committed
display done
1 parent 2c0a4b3 commit 9018390

File tree

4 files changed

+103
-38
lines changed

4 files changed

+103
-38
lines changed

DispAdapter.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ void lcd_Cls(unsigned int color){
7575
#ifdef ili9341
7676
LCD_Cls(color);
7777
#endif
78+
79+
#ifdef GCM_old_disp
80+
LCD_Clear();
81+
#endif
7882
}
7983

8084

Gascounter_main.c

Lines changed: 97 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ void store_measurement(void)
434434
Funtrace_enter(2);
435435
// write information to measurement buffer
436436
/*
437-
LCD_Clear();
437+
lcd_Cls(BGC);
438438
sprintf(print_temp,"%i.%i.%i",sendbuffer[3],sendbuffer[4],sendbuffer[5]);
439439
LCD_String(print_temp,0,1);
440440
sprintf(print_temp,"%i:%i:%i ",sendbuffer[2],sendbuffer[1],sendbuffer[0]);
@@ -460,7 +460,15 @@ void store_measurement(void)
460460
if (numberMeasBuff == MEASBUFFER_LENGTH) firstMeasBuff = nextfreeMeasBuff;
461461

462462
sprintf(print_temp,"Buff:%03d/%03d",numberMeasBuff,MEASBUFFER_LENGTH);
463+
464+
#ifdef ili9341
465+
paint_string_row(print_temp,INFO,1,"",orange);
466+
#endif
467+
#ifdef GCM_old_disp
463468
LCD_String(print_temp, 0,0);
469+
#endif
470+
471+
464472

465473

466474
}
@@ -712,11 +720,10 @@ void displayTemPreVol(void){
712720
//PRESSURE
713721
if(!(options.p_Compensation_enable && (CHECK_ERROR(TEMPPRESS_ERROR))))
714722
{
715-
LCD_Clear_row_from_column(2, 4);
716723
paint_Value(options.Pressure_value,PRESS, 1, 6, "mbar");
717724
}
718725
else{
719-
LCD_Clear_row_from_column(2, 3);
726+
720727
paint_Error("PRESS ERR",PRESS);
721728
}
722729

@@ -785,23 +792,27 @@ void displayTemPreVol(void){
785792
strcat(print_temp,versionStr);
786793

787794

788-
paint_string_row(print_temp,INFO,0,"", green);
795+
paint_string_row(print_temp,INFO,0,"", FGC);
789796

790797

791798

792799
if (ex_mode == online)
793800
{
794-
sprintf(print_temp,"Online");
801+
paint_string_row(xbee_get_coordID(),CONN,0,"", green);
795802

796803
}
797804
else
798805
{
799-
sprintf(print_temp,"%s",NetStat[NetStatIndex]);
806+
if(NetStatIndex == 1){
807+
paint_string_row(xbee_get_coordID(),CONN,0,"", orange);
808+
809+
}
810+
if(NetStatIndex == 2){
811+
paint_string_row(xbee_get_coordID(),CONN,0,"", red);
812+
}
800813
}
801-
xbee_coordIdentifier();
802-
strcat(print_temp,xbee_get_coordID());
803-
804-
paint_string_row(print_temp,CONN,0,"", green);
814+
815+
805816

806817

807818
activity_indicator++;
@@ -832,7 +843,7 @@ void displayTemPreVol(void){
832843
if ( CHECK_ERROR(TEMPPRESS_ERROR))
833844
{
834845
/*
835-
LCD_Clear();
846+
lcd_Cls(BGC);
836847
LCD_String("TempComp is",0,0);
837848
LCD_String("enabled but",0,1);
838849
LCD_String("no conn to",0,2);
@@ -846,7 +857,7 @@ void displayTemPreVol(void){
846857
if (CHECK_ERROR(TEMPPRESS_ERROR))
847858
{
848859
/*
849-
LCD_Clear();
860+
lcd_Cls(BGC);
850861
LCD_String("PressComp is",0,0);
851862
LCD_String("enabled but",0,1);
852863
LCD_String("no conn to",0,2);
@@ -1025,11 +1036,9 @@ void Temp_Press_CorrectedVolume(void)
10251036
if (options.Value < old.Value) // Checks for overflows.
10261037
{
10271038

1028-
SET_ERROR(VOLUME_TOO_BIG_ERROR);;
1029-
#ifdef USE_DISPLAY
1030-
LCD_Clear_row_from_column(6, 5);
1031-
LCD_String("Overfl.", 6, 5);
1032-
#endif
1039+
SET_ERROR(VOLUME_TOO_BIG_ERROR);
1040+
paint_info_line("Overfl",1);
1041+
10331042
}
10341043

10351044
old.Value = options.Value;
@@ -1039,11 +1048,7 @@ void Temp_Press_CorrectedVolume(void)
10391048
if (options.Volume < old.Volume) // Checks for overflows.
10401049
{
10411050
SET_ERROR(VOLUME_TOO_BIG_ERROR);;
1042-
1043-
#ifdef USE_DISPLAY
1044-
LCD_Clear_row_from_column(6, 5);
1045-
LCD_String("Overfl.", 6, 5);
1046-
#endif
1051+
paint_info_line("Overfl",1);
10471052

10481053
}
10491054

@@ -1197,7 +1202,7 @@ void reset_display(uint8_t clear)
11971202
#ifdef GCM_old_disp
11981203
if (clear)
11991204
{
1200-
LCD_Clear();
1205+
lcd_Cls(BGC);
12011206
_delay_ms(100);
12021207
}
12031208

@@ -1224,7 +1229,7 @@ void reset_display(uint8_t clear)
12241229

12251230
if (clear)
12261231
{
1227-
lcd_Cls(BGC);
1232+
lcd_Cls(white);
12281233
}
12291234

12301235
paint_Main();
@@ -1324,17 +1329,19 @@ uint8_t xbee_send_login_msg(uint8_t db_cmd_type, uint8_t *buffer)
13241329
else {
13251330

13261331
//TODO Fix
1327-
LCD_Clear();
1332+
lcd_Cls(BGC);
13281333

13291334
#ifdef ili9341
13301335
Print_add_Line("Request Opts len false",1);
1336+
paint_Value(frameBuffer[reply_Id].data_len,VOLUME,1,3,"");
13311337
#endif
13321338
#ifdef GCM_old_disp
13331339
Print_add_Line("len false",0,0);
1340+
LCD_Value(frameBuffer[reply_Id].data_len,0,0,1,"num ");
13341341
#endif
13351342

13361343

1337-
LCD_Value(frameBuffer[reply_Id].data_len,0,0,1,"num ");
1344+
13381345
_delay_ms(5000);
13391346
_delay_ms(5000);
13401347
return 0xFF; //bad options
@@ -1460,12 +1467,24 @@ void execute_server_CMDS(uint8_t reply_id){
14601467
if (frameBuffer[reply_id].data[0] == 0)
14611468
{
14621469
eeprom_Fun_Trace.Enable_eeprom_Fun_Trace = false;
1470+
1471+
#ifdef ili9341
1472+
paint_info_line("FunTrace: OFF",1);
1473+
#endif
1474+
#ifdef GCM_old_disp
14631475
LCD_String("FunTrace:OFF",0,5);
1476+
#endif
1477+
14641478
_delay_ms(2000);
14651479
}else
14661480
{
14671481
eeprom_Fun_Trace.Enable_eeprom_Fun_Trace = true;
1468-
LCD_String("FunTrace: ON",0,5);
1482+
#ifdef ili9341
1483+
paint_info_line("FunTrace: ON",1);
1484+
#endif
1485+
#ifdef GCM_old_disp
1486+
LCD_String("FunTrace:ON",0,5);
1487+
#endif
14691488
_delay_ms(2000);
14701489

14711490
eeprom_write_word(&funtrace_was_activated,FUNTRACE_PASS);
@@ -1632,7 +1651,7 @@ uint8_t analyze_Connection(void)
16321651
#ifdef USE_XBEE
16331652

16341653

1635-
if (!xbee_reconnect())
1654+
if (!xbee_reconnect(0))
16361655
{
16371656
//Associated
16381657
ex_mode = online;
@@ -1755,7 +1774,7 @@ void Set_Options(uint8_t *optBuffer,uint8_t answer_code){
17551774

17561775
#ifdef TP_comp_debug
17571776

1758-
LCD_Clear();
1777+
lcd_Cls(BGC);
17591778
if (optholder.T_Compensation_enable)
17601779
{
17611780
Print_add_Line("Tcomp ena",1);
@@ -1958,14 +1977,14 @@ int main(void)
19581977

19591978
/*
19601979
adc_init(0x0e);
1961-
LCD_Clear();
1980+
lcd_Cls(BGC);
19621981
while (1)
19631982
{
19641983
double Vcc = readChannel( (_BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1)),20) ;
19651984
sprintf(print_temp,"%f V",Vcc);
19661985
LCD_String(print_temp,0,0);
19671986
_delay_ms(100);
1968-
LCD_Clear();
1987+
lcd_Cls(BGC);
19691988
_delay_ms(50);
19701989
}
19711990
*/
@@ -2001,6 +2020,9 @@ int main(void)
20012020
uint8_t sim_xb_rep = 0xFF;
20022021

20032022
_Bool CoordActive = false;
2023+
2024+
// set default sc mask
2025+
xbee_Set_Scan_Channels(xbee.ScanChannels);
20042026
// main part
20052027
while(1)
20062028
{
@@ -2051,7 +2073,7 @@ int main(void)
20512073
#ifdef USE_XBEE
20522074

20532075

2054-
if(xbee_reset_connection())
2076+
if(xbee_reset_connection(0))
20552077
{
20562078
if(xbee_get_server_adrr())
20572079
{
@@ -2121,7 +2143,7 @@ int main(void)
21212143
{
21222144
while (1)
21232145
{
2124-
LCD_Clear();
2146+
lcd_Cls(BGC);
21252147
Print_add_Line("Errors:",1);
21262148
_delay_ms(2000);
21272149
//==============================================
@@ -2152,6 +2174,7 @@ int main(void)
21522174
}else // One measure send cycle on startup
21532175

21542176
{
2177+
xbee_coordIdentifier(); // get name of connected Coordinator
21552178
reset_display(0);
21562179
//MEASUREMENT BLOCK
21572180
if (connected.BMP){ // measurement is only done if T OR P compensation is enabled
@@ -2382,11 +2405,19 @@ int main(void)
23822405
uint8_t i2cState = I2C_ClearBus();
23832406

23842407

2385-
LCD_Clear();
2408+
lcd_Cls(BGC);
23862409
char twiStr[11] ="";
23872410
sprintf(twiStr,"clearBUS:%d",i2cState);
23882411

2412+
#ifdef ili9341
2413+
paint_string_row("I2C Bus Recovery",INFO,1,"",white);
2414+
paint_string_row(twiStr,VALUE,1,"",FGC);
2415+
#endif
2416+
#ifdef GCM_old_disp
23892417
LCD_String(twiStr,0,0);
2418+
#endif
2419+
2420+
23902421

23912422
connected.TWI = 1;
23922423
connected.DS3231M = 1;
@@ -2399,24 +2430,48 @@ int main(void)
23992430
DS3231M_read_time();
24002431
if(!CHECK_ERROR(TIMER_ERROR))
24012432
{
2402-
CLEAR_ERROR(I2C_BUS_ERROR);;
2433+
CLEAR_ERROR(I2C_BUS_ERROR);
2434+
#ifdef ili9341
2435+
paint_string_row("DS3231M OK",CORRVOL,1,"",FGC);
2436+
#endif
2437+
#ifdef GCM_old_disp
24032438
LCD_String("DS3231M OK",0,3);
2439+
#endif
2440+
24042441
}else{
2442+
#ifdef ili9341
2443+
paint_string_row("DS3231M NO",CORRVOL,1,"",FGC);
2444+
#endif
2445+
#ifdef GCM_old_disp
24052446
LCD_String("DS3231M NO",0,3);
2447+
#endif
24062448
}
24072449

24082450

24092451

24102452
if (!BMP_Temp_and_Pressure())
24112453
{
2454+
#ifdef ili9341
2455+
paint_string_row("TEM/PRES OK",VOLUME,1,"",FGC);
2456+
#endif
2457+
#ifdef GCM_old_disp
24122458
LCD_String("TEM/PRES OK",0,2);
2459+
#endif
2460+
2461+
2462+
24132463
CLEAR_ERROR(TEMPPRESS_ERROR);;
24142464
CLEAR_ERROR(I2C_BUS_ERROR);;
24152465
connected.BMP =1 ;
24162466
}
24172467
else
24182468
{
2469+
#ifdef ili9341
2470+
paint_string_row("TEM/PRES NO",VOLUME,1,"",FGC);
2471+
#endif
2472+
#ifdef GCM_old_disp
24192473
LCD_String("TEM/PRES NO",0,2);
2474+
#endif
24202475
connected.BMP = 0;
24212476
}
24222477

@@ -2518,7 +2573,7 @@ int main(void)
25182573
if (count_t_elapsed % (options.Ping_Intervall*60) == 2){
25192574
#ifdef USE_XBEE
25202575

2521-
if (!xbee_reconnect())
2576+
if (!xbee_reconnect(0))
25222577
{
25232578
ex_mode = online;
25242579
//Associated
@@ -2569,7 +2624,13 @@ int main(void)
25692624
while (!CHECK_ERROR(NETWORK_ERROR) && ((numberMeasBuff) > 0))
25702625
{
25712626
sprintf(print_temp,"%03d",numberMeasBuff);
2627+
#ifdef ili9341
2628+
paint_string_row(print_temp,VOLUME,1,"",FGC);
2629+
#endif
2630+
#ifdef GCM_old_disp
25722631
LCD_String(print_temp,0,3);
2632+
#endif
2633+
25732634
memcpy(sendbuffer,measBuffer[firstMeasBuff].data,MEASUREMENT_MESSAGE_LENGTH);
25742635
if( xbee_send_request(MEAS_MSG,sendbuffer, MEASUREMENT_MESSAGE_LENGTH) == 0xFF )
25752636
{//=========================

Gascounter_main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define MEASUREMENT_MESSAGE_LENGTH 23 /**< @brief Number of Bytes that makes up one Measurement Message*/
3737
#define NUMBER_LOGIN_BYTES 36 /**< @brief Number of Bytes in login Message from Server */
3838

39-
#define COM_TIMEOUT_TIME 10 /**< @brief Communication Timeout-period in Seconds */
39+
//#define COM_TIMEOUT_TIME 10 /**< @brief Communication Timeout-period in Seconds */
4040

4141

4242

avr-util-library

Submodule avr-util-library updated from 82def62 to 8144003

0 commit comments

Comments
 (0)