avr: added code and messages for device information.

- send firmware information in DEVICE message
- introduced new version of VALUE message (sending UID now instead of
  timestamp)
- make SENDSTATS and RECVSTATS messages also send UID instead of timestamp
This commit is contained in:
Martin Preuss
2023-03-19 23:20:16 +01:00
parent 9b7e72c3ad
commit 0db8a14972
4 changed files with 137 additions and 9 deletions

View File

@@ -40,16 +40,18 @@
; ---------------------------------------------------------------------------
; list of modules to use
; firmware settings including list of modules used
#define FW_TYPE AQHOME_FW_TYPE_ATT84_TEMP1
#define FW_MAIN_VERSION_HIGH 0
#define FW_MAIN_VERSION_LOW 1
#define MODULES_TIMER
#define MODULES_COM
#define MODULES_LED
#define MODULES_TWI_MASTER
#define MODULES_LCD
;#define MODULES_LCD
#define MODULES_SI7021
.set MODULES_MASK = 0
@@ -242,8 +244,6 @@ ledA3Flash: .db DDRA+0x20, PORTA+0x20, PINA+0x20, (1<<PORTA3)
blinkPattern: .db 2, 50, 0xff, 0xff ; 1 short blink, 2s pause, restart
;blinkPattern2: .db 10, 20, 0xff, 0xff ; 1 long blink, 2s pause, restart
firmwareHeader: .db FW_MAIN_VERSION_HIGH, FW_MAIN_VERSION_LOW
.dw MODULES_MASK
.include "main.asm"
@@ -292,7 +292,9 @@ onEverySecond:
; Called every 10 seconds. Add your routine calls here. No arguments, no results.
onEvery10s:
#ifdef MODULES_LCD
rcall printSendStats
#endif
ret
@@ -322,15 +324,22 @@ onEveryMinute:
lds r16, comAddress ; do we have an address assigned?
tst r16
breq onEveryMinute_l1 ; no, do nothing
; will later send this only every hour or so
ldi r16, 0xff ; send stats to everybody
rcall CPRO_EnqueueComSendStats
ldi r16, 0xff ; send recv to everybody
rcall CPRO_EnqueueComRecvStats
ldi r16, 0xff ; send device info to everybody
rcall CPRO_EnqueueDevice
onEveryMinute_l1:
#endif
ret
; ---------------------------------------------------------------------------
; Called every 15 minutes. Add your routine calls here. No arguments, no results.