avr: improved timer module.

- simplified timer handling. still using cascading counters but in an
  extendable way
- added onEvery5m while on it
- renamed everyMinute to every1m (unifies routine names)
- send network stats every 5m, not every minute
This commit is contained in:
Martin Preuss
2023-04-08 02:22:23 +02:00
parent 7eb462173c
commit 5175ca7dfd
3 changed files with 129 additions and 166 deletions

View File

@@ -326,28 +326,39 @@ onEvery30s:
; ---------------------------------------------------------------------------
; Called every minute. Add your routine calls here. No arguments, no results.
onEveryMinute:
onEvery1m:
#ifdef MODULES_COM
lds r16, comAddress ; do we have an address assigned?
tst r16
breq onEveryMinute_l1 ; no, do nothing
breq onEvery1m_l1 ; no, do nothing
; will later send this only every hour or so
; will later send this only every hour or so
ldi r16, 0xff ; send device info to everybody
rcall CPRO_EnqueueDevice
onEvery1m_l1:
#endif
ret
; ---------------------------------------------------------------------------
; Called every 5 minutes. Add your routine calls here. No arguments, no results.
onEvery5m:
#ifdef MODULES_COM
; will later send these 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.