more work on switching to new COM and TIMER stack.

This commit is contained in:
Martin Preuss
2023-04-13 21:16:51 +02:00
parent a61226c3d9
commit c00b90bf28
9 changed files with 168 additions and 64 deletions

View File

@@ -239,7 +239,7 @@
.include "comproto_sysstats.asm"
.include "comproto_memstats.asm"
.include "comproto_pong.asm"
; .include "comproto_values.asm"
.include "comproto_values.asm"
#endif
#endif
#ifdef MODULES_TWI_MASTER
@@ -266,8 +266,12 @@
#ifdef MODULES_LCD
sramTimerWriteStats: .byte 2
#endif
sramTimerEnqueueValues: .byte 2
sramTimerSI7021Measure: .byte 2
sramTimerEnqueueValues: .byte 2
#ifdef MODULES_SI7021
sramTimerSI7021Measure: .byte 2
sramTimerSI7021SendTemp: .byte 2
sramTimerSI7021SendHumidity: .byte 2
#endif
#ifdef MODULES_LCD
sramPeriodicalLcdMark: .byte 2
#endif
@@ -290,19 +294,22 @@ blinkPattern: .db 2, 50, 0xff, 0xff ; 1 short blink, 2s pause, restart
timerList:
; SRAM variable/counter routine flags secs (0=don't start or restart)
; SRAM variable/counter routine flags secs (0=don't start or restart)
#ifdef MODULES_COM_WITH_ADDR_PROTO
.dw cproAddresModeTimer, CPRO_Address_OnTimer, 0, 0 ; (no restart)
.dw cproAddresModeTimer, CPRO_Address_OnTimer, 0, 0 ; (no restart)
#endif
#ifdef MODULES_STATS
.dw statsSendTimer, Stats_Timer, TIMER_FLAGS_IF_ADDR, 30 ; every 30s
.dw statsSendTimer, Stats_Timer, TIMER_FLAGS_IF_ADDR, 30 ; every 30s
#endif
#ifdef MODULES_LCD
.dw sramPeriodicalLcdMark, periodicalLcdMark, 0, 1 ; every sec
.dw sramTimerWriteStats, writeStats, 0, 10
.dw sramPeriodicalLcdMark, periodicalLcdMark, 0, 1 ; every sec
.dw sramTimerWriteStats, writeStats, 0, 10
#endif
#ifdef MODULES_SI7021
.dw sramTimerSI7021Measure, SI7021_PeriodicMeasurement, 0, 30 ; every 30s
.dw sramTimerSI7021SendTemp, sendTemp, TIMER_FLAGS_IF_ADDR, 60 ; every 60s
.dw sramTimerSI7021SendHumidity, sendHumidity, TIMER_FLAGS_IF_ADDR, 60 ; every 60s
#endif
.dw sramTimerSI7021Measure, SI7021_PeriodicMeasurement, 0, 30 ; every 30s
; .dw sramTimerEnqueueValues, Main_SendValueMsg, TIMER_FLAGS_IF_ADDR, 60 ; every 1m
.dw 0 ; end of list
@@ -332,6 +339,31 @@ writeStats:
#ifdef MODULES_SI7021
sendHumidity:
rcall SI7021_SendHumidity
brcs sendHumidity_okay
; set timer to 1s to retry later
ldi xl, LOW(sramTimerSI7021SendHumidity)
ldi xh, HIGH(sramTimerSI7021SendHumidity)
rjmp Timer_SetValueTo1s
sendHumidity_okay:
ret
sendTemp:
rcall SI7021_SendTemp
brcs sendTemp_okay
; set timer to 1s to retry later
ldi xl, LOW(sramTimerSI7021SendTemp)
ldi xh, HIGH(sramTimerSI7021SendTemp)
rjmp Timer_SetValueTo1s
sendTemp_okay:
ret
#endif
; ---------------------------------------------------------------------------