t03: adapted to latest changes.
This commit is contained in:
@@ -103,7 +103,8 @@ devInfoVersion: .db DEVICEINFO_VERSION, DEVICEINFO_REVISION ; v
|
||||
firmwareVersion: .db FIRMWARE_VARIANT_BOOT, FIRMWARE_VERSION_MAJOR
|
||||
.db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
|
||||
|
||||
firmwareStart: rjmp main ; will be overwritten when flashing
|
||||
firmwareStart:
|
||||
rjmp main ; will be overwritten when flashing
|
||||
|
||||
|
||||
|
||||
@@ -130,6 +131,7 @@ main:
|
||||
.include "modules/flash/eeprom.asm"
|
||||
.include "modules/flash/io.asm"
|
||||
.include "modules/flash/io_uart1.asm"
|
||||
.include "modules/flash/flashxp.asm"
|
||||
.include "modules/flash/flash4p.asm"
|
||||
.include "modules/flash/flashprocess.asm"
|
||||
.include "modules/flash/wait.asm"
|
||||
|
||||
@@ -26,9 +26,12 @@
|
||||
|
||||
;.equ SEND_DEVICE_EVERY = 3000
|
||||
.equ SEND_DEVICE_EVERY = 3000 ; every 5mins
|
||||
;.equ SEND_STATS_EVERY = 3100 ; about every 5mins
|
||||
.equ SEND_STATS_EVERY = 300 ; every 30s
|
||||
.equ SEND_DEBUG_EVERY = 110
|
||||
.equ SEND_STATS_EVERY = 3100 ; about every 5mins
|
||||
;.equ SEND_STATS_EVERY = 300 ; every 30s
|
||||
;.equ SEND_DEBUG_EVERY = 110
|
||||
|
||||
;#define WITH_SEND_DEBUG
|
||||
|
||||
|
||||
.nolist
|
||||
.include "include/tn841def.inc" ; Define device ATtiny841
|
||||
@@ -159,6 +162,14 @@ firmwareStart:
|
||||
|
||||
sei
|
||||
main_loop:
|
||||
rcall BaseTimer_Run
|
||||
rcall TtyOnUart1_Run
|
||||
rcall ComOnUart0_Run
|
||||
|
||||
; check incoming msg
|
||||
rcall checkRecvdMsg
|
||||
; rcall freeRecvdMsg
|
||||
|
||||
; only modify SE, SM1 and SM0
|
||||
cli
|
||||
in r16, MCUCR
|
||||
@@ -170,13 +181,6 @@ main_loop:
|
||||
sei ; make sure interrupts really are enabled
|
||||
sleep ; sleep, wait for interrupt
|
||||
|
||||
rcall BaseTimer_Run
|
||||
rcall TtyOnUart1_Run
|
||||
rcall ComOnUart0_Run
|
||||
|
||||
; check incoming msg
|
||||
rcall checkRecvdMsg
|
||||
; rcall freeRecvdMsg
|
||||
rjmp main_loop
|
||||
|
||||
|
||||
@@ -209,7 +213,9 @@ onSystemTimerTick:
|
||||
#endif
|
||||
rcall TtyOnUart1_Periodically
|
||||
rcall ComOnUart0_Periodically
|
||||
; rcall sendDebug
|
||||
#ifdef WITH_SEND_DEBUG
|
||||
rcall sendDebug
|
||||
#endif
|
||||
; rcall maybeSendDeviceMsg
|
||||
rcall maybeSendTStatsMsg
|
||||
rcall maybeSendRStatsMsg
|
||||
@@ -270,10 +276,12 @@ initModules:
|
||||
ldi r16, HIGH(SEND_STATS_EVERY+20)
|
||||
sts sendMStatsCounter+1, r16
|
||||
|
||||
#ifdef WITH_SEND_DEBUG
|
||||
ldi r16, LOW(SEND_DEBUG_EVERY)
|
||||
sts debugMsgCounter, r16
|
||||
ldi r16, HIGH(SEND_DEBUG_EVERY)
|
||||
sts debugMsgCounter+1, r16
|
||||
#endif
|
||||
|
||||
ret
|
||||
; @end
|
||||
@@ -303,6 +311,7 @@ initModules:
|
||||
.include "modules/network/iface.asm"
|
||||
.include "modules/network/msg/defs.asm"
|
||||
.include "modules/network/msg/common.asm"
|
||||
.include "modules/network/msg/crc.asm"
|
||||
.include "modules/network/msg/device-w.asm"
|
||||
.include "modules/network/msg/sendstats-w.asm"
|
||||
.include "modules/network/msg/recvstats-w.asm"
|
||||
@@ -500,7 +509,7 @@ checkRecvdMsg:
|
||||
rcall NET_Buffer_Locate ; (R17)
|
||||
ld r17, X
|
||||
andi r17, (NET_IFACE_BUFFER_IFACENUM1_BIT | NET_IFACE_BUFFER_IFACENUM0_BIT)
|
||||
rcall reverseInterfaceNum
|
||||
rcall reverseInterfaceNum ; (R17)
|
||||
; ldi r17, TTYONUART1_IFACENUM ; DEBUG: send everything to uart1 to test that code first
|
||||
rcall addMsgToInterface
|
||||
brcc checkRecvdMsg_end ; could not add, jmp
|
||||
@@ -557,7 +566,7 @@ addMsgToInterface_end:
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
#ifdef WITH_SEND_DEBUG
|
||||
sendDebug:
|
||||
ldi yl, LOW(ttyOnUart1_iface)
|
||||
ldi yh, HIGH(ttyOnUart1_iface)
|
||||
@@ -650,6 +659,7 @@ writeBufferInfoToRegs:
|
||||
ldd r18, Y+(1+3) ; source addr
|
||||
writeBufferInfoToRegs_end:
|
||||
ret
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -730,7 +740,9 @@ programRamBegin:
|
||||
sendTStatsCounter: .byte 2
|
||||
sendRStatsCounter: .byte 2
|
||||
sendMStatsCounter: .byte 2
|
||||
#ifdef WITH_SEND_DEBUG
|
||||
debugMsgCounter: .byte 2
|
||||
#endif
|
||||
programRamEnd:
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user