Skip to content

Commit 5ac4f18

Browse files
author
Wegmann Peter
committed
updated init strings anwert to unknown at commands
1 parent 378f6d6 commit 5ac4f18

File tree

5 files changed

+65
-29
lines changed

5 files changed

+65
-29
lines changed

Gascounter_main.c

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
#include "StringPixelCoordTabble_old.h"
4949
#endif
5050

51+
#ifdef ili9341
52+
#include "StringPixelCoordTable_ili9341.h"
53+
#endif
54+
5155
#include "I2C_utilities.h"
5256
#include "module_globals.h"
5357
#include "adwandler.h"
@@ -531,11 +535,11 @@ void init(void)
531535

532536
#ifdef ili9341
533537
setInitScreen(black,white,6,1,1,1);
534-
Print_add_Line("HZB Gascount",0);
538+
Print_add_Line(STR_HZB_GASCOUNTER,0);
535539
#endif
536540

537541
#ifdef GCM_old_disp
538-
Print_add_Line("HZB Gascount",1);
542+
Print_add_Line(STR_HZB_GASCOUNTER,1);
539543
#endif
540544

541545

@@ -544,34 +548,34 @@ void init(void)
544548
sprintf(print_temp,"v%i.%i",version.Branch_id,version.Fw_version);
545549
Print_add_Line(print_temp,0);
546550
#ifdef USE_LAN
547-
Print_add_Line("LAN-VARIANT",0);
551+
Print_add_Line(STR_LAN_VARIANT,0);
548552
#endif
549553
#ifdef USE_XBEE
550-
Print_add_Line("XBEE-VARIANT",0);
554+
Print_add_Line(STR_XBEE_VARIANT,0);
551555
#endif
552556

553557

554558

555559

556560
#ifdef ili9341
557-
Print_add_Line("Init start",0);
561+
Print_add_Line(STR_INIT_START,0);
558562
#endif
559563

560564
#ifdef GCM_old_disp
561565
_delay_ms(2000); // the delay is for the xbee to start when the system is plugged in
562-
Print_add_Line("Init start",1);
566+
Print_add_Line(STR_INIT_START,1);
563567
#endif
564568

565569

566-
Print_add_Line("Init ports",2);
570+
Print_add_Line(STR_INIT_PORTS,2);
567571

568-
Print_add_Line("Init timer",2);
572+
Print_add_Line(STR_INIT_TIMER,2);
569573
init_timer();
570-
Print_add_Line("Init interr.",2);
574+
Print_add_Line(STR_INIT_INTERRUPTS,2);
571575
init_interrupts();
572-
Print_add_Line("Init usart",2);
576+
Print_add_Line(STR_INIT_USART,2);
573577
usart_init(39);
574-
Print_add_Line("Init I2C",2);
578+
Print_add_Line(STR_INIT_I2C,2);
575579
i2c_init();
576580

577581

@@ -590,16 +594,16 @@ void init(void)
590594

591595

592596
// Timer
593-
Print_add_Line("Init Clock",2);
597+
Print_add_Line(STR_INIT_CLOCK,2);
594598

595599
if (init_DS3231M(&paint_info_line) == 0) // trying to connect with DS3231M (time)
596600
{
597601
connected.DS3231M = 1;
598602
#ifdef ili9341
599-
Print_add_Line("Init Clock ...success",2);
603+
Print_add_Line(STR_INIT_CLOCK_SUCC,2);
600604
#endif
601605
#ifdef GCM_old_disp
602-
Print_add_Line("...success",0);
606+
Print_add_Line(STR_INIT_CLOCK_SUCC,0);
603607
#endif
604608

605609
}
@@ -608,25 +612,25 @@ void init(void)
608612
connected.DS3231M = 0;
609613
SET_ERROR(TIMER_ERROR);
610614
#ifdef ili9341
611-
Print_add_Line("Init Clock ...error",2);
615+
Print_add_Line(STR_INIT_CLOCK_ERR,2);
612616
#endif
613617
#ifdef GCM_old_disp
614-
Print_add_Line("...error",0);
618+
Print_add_Line(STR_INIT_CLOCK_ERR,0);
615619
#endif
616620
}
617621

618622
// Pressure and Temperature Sensor
619-
Print_add_Line("Init Press",0);
623+
Print_add_Line(STR_INIT_PRESS,0);
620624

621625
if (init_BMP(&paint_info_line) == 0) // trying to connect with BMP
622626
{
623627
connected.BMP = 1;
624628
connected.BMP_on_Startup = 1;
625629
#ifdef ili9341
626-
Print_add_Line("Init Press ...success",2);
630+
Print_add_Line(STR_INIT_PRESS_SUCC,2);
627631
#endif
628632
#ifdef GCM_old_disp
629-
Print_add_Line("...success",0);
633+
Print_add_Line(STR_INIT_PRESS_SUCC,0);
630634
#endif
631635
CLEAR_ERROR(TEMPPRESS_ERROR);;
632636
}
@@ -646,7 +650,7 @@ void init(void)
646650
xbee_init(&paint_info_line,NULL,0);
647651

648652
xbee_hardware_version();
649-
Print_add_Line("Init done",0);
653+
Print_add_Line(STR_INIT_DONE,0);
650654

651655

652656

@@ -1233,6 +1237,25 @@ void execute_server_CMDS(uint8_t reply_id){
12331237

12341238
xbee_pseudo_send_AT_response( 'N', 'I', 0, sendbuffer, 0);
12351239

1240+
default:;
1241+
uint8_t AT_Code = frameBuffer[reply_id].type;
1242+
1243+
1244+
// handle unknown AT command
1245+
if (AT_Code >= 200)
1246+
{
1247+
1248+
1249+
xbee_pseudo_send_AT_response(
1250+
AT_Lut[(uint8_t)(AT_Code-AT_START)][0], // translate AT_code back to At ASCII chars
1251+
AT_Lut[(uint8_t)(AT_Code-AT_START)][1],
1252+
1, // Status == 1 --> atcommand not known
1253+
sendbuffer,
1254+
0); // empty payload
1255+
}
1256+
1257+
break;
1258+
12361259
#endif
12371260

12381261
}
@@ -1392,9 +1415,7 @@ void Set_Options(uint8_t *optBuffer,uint8_t answer_code){
13921415
.delta_V = (((uint32_t) optBuffer[22] << 8) | optBuffer[23])* 1000 ,
13931416
.delta_p = ((uint16_t) optBuffer[24] << 8) | optBuffer[25],
13941417
.step_Volume = (((uint32_t) optBuffer[26] << 8) | optBuffer[27])* 1000 ,
1395-
//.offset_pressure = ((int16_t) optBuffer[28] << 8) | optBuffer[29], // the value is transmitted with +32768 because no negative numbers can be transmitted
1396-
//.span_pressure = ((uint16_t) optBuffer[30] << 8) | optBuffer[31],
1397-
.T_Compensation_enable = optBuffer[28], //TODO Decrease bytenum by 4...
1418+
.T_Compensation_enable = optBuffer[28],
13981419
.Temperature_norm = ((uint16_t) optBuffer[29] << 8) | optBuffer[30] ,
13991420
.p_Compensation_enable = optBuffer[31] ,
14001421
.Pressure_norm = ((uint16_t) optBuffer[32] << 8) | optBuffer[33],

Gascounter_main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ extern enum PARENT_MODE ex_mode;
315315
extern uint16_t status_reset_on_send;
316316
extern optType options;
317317
extern uint8_t position_volume_dot_point;
318-
318+
extern char AT_Lut[22] [2];
319319
// I²C Codes
320320

321321
#define DEVICE_NOT_CONNECTED 2

StringPixelCoordTable_ili9341.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,22 @@
9797
#define X_PIL_2 20 // Info line Directly above Progress-Bar and to the right of
9898
#define Y_PIL_90 290 // Buttons/edge
9999

100-
100+
// INIT STRINGS
101+
#define STR_HZB_GASCOUNTER "HZB Gascounter-Module"
102+
#define STR_LAN_VARIANT "LAN-VARIANT"
103+
#define STR_XBEE_VARIANT "XBEE-VARIANT"
104+
#define STR_INIT_START "Init start"
105+
#define STR_INIT_PORTS "Init I/O-ports"
106+
#define STR_INIT_TIMER "Init MCU-timers"
107+
#define STR_INIT_INTERRUPTS "Init interrpts"
108+
#define STR_INIT_USART "Init USART"
109+
#define STR_INIT_I2C "Init I2C-BUS"
110+
#define STR_INIT_CLOCK "Init DS3231M RTC"
111+
#define STR_INIT_CLOCK_SUCC "Init DS3231M RTC ...success"
112+
#define STR_INIT_CLOCK_ERR "Init DS3231M RTC ...error"
113+
#define STR_INIT_PRESS "Init BMP085"
114+
#define STR_INIT_PRESS_SUCC "Init BMP085 ...success"
115+
#define STR_INIT_DONE "Init done"
101116

102117

103118

avr-util-library

Submodule avr-util-library updated from 1ab3422 to dc338e8

gascounter-module.cproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@
6666
<preserveEEPROM>true</preserveEEPROM>
6767
<avrtoolserialnumber>J50200002200</avrtoolserialnumber>
6868
<avrdeviceexpectedsignature>0x1E9705</avrdeviceexpectedsignature>
69-
<avrtoolinterfaceclock>1041606</avrtoolinterfaceclock>
69+
<avrtoolinterfaceclock>999944</avrtoolinterfaceclock>
7070
<com_atmel_avrdbg_tool_powerdebugger>
7171
<ToolOptions>
7272
<InterfaceProperties>
73-
<IspClock>1041606</IspClock>
73+
<IspClock>999944</IspClock>
7474
</InterfaceProperties>
7575
<InterfaceName>ISP</InterfaceName>
7676
</ToolOptions>
@@ -135,7 +135,7 @@
135135
<Value>DEBUG</Value>
136136
<Value>F_CPU=6144000</Value>
137137
<Value>GASCOUNTER_MODULE</Value>
138-
<Value>USE_XBEE</Value>
138+
<Value>USE_LAN</Value>
139139
<Value>GCM_old_disp</Value>
140140
</ListValues>
141141
</avrgcc.compiler.symbols.DefSymbols>

0 commit comments

Comments
 (0)