reportsensors: use table.
This commit is contained in:
@@ -15,8 +15,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
@@ -48,6 +46,7 @@ AppReportSensors_Fini:
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine AppReportSensors_OnEverySecond @global
|
||||
;
|
||||
@@ -69,139 +68,187 @@ AppReportSensors_OnEverySecond_noIrqs:
|
||||
AppReportSensors_OnEverySecond_store:
|
||||
sts reportSensorTimer, r16
|
||||
|
||||
#ifdef MODULES_SGP30
|
||||
; push r16
|
||||
; rcall SGP30_Measure
|
||||
; pop r16
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_SI7021
|
||||
cpi r16, 1
|
||||
breq AppReportSensors_OnEverySecond_measureValue1
|
||||
cpi r16, 11
|
||||
breq AppReportSensors_OnEverySecond_measureValue2
|
||||
cpi r16, 16
|
||||
breq AppReportSensors_OnEverySecond_sendValue1
|
||||
cpi r16, 21
|
||||
breq AppReportSensors_OnEverySecond_sendValue2
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_MULTIFAN
|
||||
cpi r16, 32
|
||||
breq AppReportSensors_OnEverySecond_sendValueMF1
|
||||
cpi r16, 33
|
||||
breq AppReportSensors_OnEverySecond_sendValueMF2
|
||||
cpi r16, 34
|
||||
breq AppReportSensors_OnEverySecond_sendValueMF3
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_SGP40
|
||||
cpi r16, 53
|
||||
breq AppReportSensors_OnEverySecond_measureValue4
|
||||
cpi r16, 63
|
||||
breq AppReportSensors_OnEverySecond_sendValue4
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_SGP30
|
||||
cpi r16, 53
|
||||
breq AppReportSensors_OnEverySecond_sendValue5
|
||||
cpi r16, 63
|
||||
breq AppReportSensors_OnEverySecond_sendValue6
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_DS18B20
|
||||
cpi r16, 84
|
||||
breq AppReportSensors_OnEverySecond_sendValue3
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_CCS811
|
||||
cpi r16, 94
|
||||
breq AppReportSensors_OnEverySecond_sendCCS811_TVOC
|
||||
cpi r16, 104
|
||||
breq AppReportSensors_OnEverySecond_sendCCS811_CO2
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_BRIGHTNESS
|
||||
cpi r16, 97
|
||||
breq AppReportSensors_OnEverySecond_sendBrightness
|
||||
#endif
|
||||
|
||||
#ifdef APPS_DOOR
|
||||
cpi r16, 100
|
||||
breq AppReportSensors_OnEverySecond_sendDoorValue
|
||||
#endif
|
||||
|
||||
#ifdef APPS_MOTION
|
||||
cpi r16, 108
|
||||
breq AppReportSensors_OnEverySecond_sendMotionValue
|
||||
#endif
|
||||
|
||||
rcall appReportSensorsWalkTable
|
||||
ret
|
||||
|
||||
#ifdef MODULES_SI7021
|
||||
AppReportSensors_OnEverySecond_measureValue1:
|
||||
rjmp SI7021_MeasureTemp
|
||||
AppReportSensors_OnEverySecond_measureValue2:
|
||||
rjmp SI7021_MeasureHumidity
|
||||
AppReportSensors_OnEverySecond_sendValue1:
|
||||
rjmp SI7021_SendTemperature
|
||||
AppReportSensors_OnEverySecond_sendValue2:
|
||||
rjmp SI7021_SendHumidity
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_DS18B20
|
||||
AppReportSensors_OnEverySecond_sendValue3:
|
||||
rjmp Ds18b20_SendTemperature
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_MULTIFAN
|
||||
AppReportSensors_OnEverySecond_sendValueMF1:
|
||||
bigjmp MultiFan_ReportSpeed1
|
||||
AppReportSensors_OnEverySecond_sendValueMF2:
|
||||
bigjmp MultiFan_ReportSpeed2
|
||||
AppReportSensors_OnEverySecond_sendValueMF3:
|
||||
bigjmp MultiFan_ReportSpeed3
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_SGP40
|
||||
AppReportSensors_OnEverySecond_measureValue4:
|
||||
rjmp SGP40_MeasureRawSignal
|
||||
AppReportSensors_OnEverySecond_sendValue4:
|
||||
rjmp SGP40_SendTVOC
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_SGP30
|
||||
AppReportSensors_OnEverySecond_sendValue5:
|
||||
rjmp SGP30_SendTVOC
|
||||
ret
|
||||
AppReportSensors_OnEverySecond_sendValue6:
|
||||
rjmp SGP30_SendCO2
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_CCS811
|
||||
AppReportSensors_OnEverySecond_sendCCS811_TVOC:
|
||||
rjmp CCS811_SendTVOC
|
||||
AppReportSensors_OnEverySecond_sendCCS811_CO2:
|
||||
rjmp CCS811_SendCO2
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_BRIGHTNESS
|
||||
AppReportSensors_OnEverySecond_sendBrightness:
|
||||
rjmp Brightness_Send
|
||||
#endif
|
||||
|
||||
#ifdef APPS_DOOR
|
||||
AppReportSensors_OnEverySecond_sendDoorValue:
|
||||
rjmp appDoorSendValue
|
||||
#endif
|
||||
|
||||
#ifdef APPS_MOTION
|
||||
AppReportSensors_OnEverySecond_sendMotionValue:
|
||||
rjmp appMotionSendValue
|
||||
#endif
|
||||
|
||||
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine appReportSensorsWalkTable
|
||||
;
|
||||
; @clobbers r16, r18, r19, r22, Z, (any)
|
||||
|
||||
appReportSensorsWalkTable:
|
||||
ldi zl, LOW(appReportSensorsTable*2)
|
||||
ldi zh, HIGH(appReportSensorsTable*2)
|
||||
lds r22, reportSensorTimer
|
||||
appReportSensorsWalkTable_loop:
|
||||
lpm r16, Z+
|
||||
adiw zh:zl, 1
|
||||
lpm r18, Z+
|
||||
lpm r19, Z+
|
||||
mov r17, r18 ; routine==0?
|
||||
or r17, r19
|
||||
breq appReportSensorsWalkTable_loopEnd ; yes, end of table
|
||||
tst r16 ; timer==0?
|
||||
breq appReportSensorsWalkTable_loopCall ; yes, match any value
|
||||
cp r22, r16
|
||||
brne appReportSensorsWalkTable_loopNext ; skip
|
||||
appReportSensorsWalkTable_loopCall:
|
||||
push r22
|
||||
push zl
|
||||
push zh
|
||||
push yl
|
||||
push yh
|
||||
rcall appReportSensorsCallR19R18
|
||||
pop yh
|
||||
pop yl
|
||||
pop zh
|
||||
pop zl
|
||||
pop r22
|
||||
appReportSensorsWalkTable_loopNext:
|
||||
rjmp appReportSensorsWalkTable_loop
|
||||
appReportSensorsWalkTable_loopEnd:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine appReportSensorsCallR19R18
|
||||
; Call route at address r19:r18
|
||||
|
||||
appReportSensorsCallR19R18:
|
||||
push r18
|
||||
push r19
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef MODULES_SI7021
|
||||
appReportSensorsSi7021MeasureValue1:
|
||||
rjmp SI7021_MeasureTemp
|
||||
|
||||
appReportSensorsSi7021MeasureValue2:
|
||||
rjmp SI7021_MeasureHumidity
|
||||
|
||||
appReportSensorsSi7021SendValue1:
|
||||
rjmp SI7021_SendTemperature
|
||||
|
||||
appReportSensorsSi7021SendValue2:
|
||||
rjmp SI7021_SendHumidity
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_DS18B20
|
||||
appReportSensorsDs18b20SendValue:
|
||||
rjmp Ds18b20_SendTemperature
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MODULES_MULTIFAN
|
||||
appReportSensorsMultiFanSendValue1:
|
||||
bigjmp MultiFan_ReportSpeed1
|
||||
|
||||
appReportSensorsMultiFanSendValue2:
|
||||
bigjmp MultiFan_ReportSpeed2
|
||||
|
||||
appReportSensorsMultiFanSendValue3:
|
||||
bigjmp MultiFan_ReportSpeed3
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MODULES_SGP40
|
||||
appReportSensorsSgp40MeasureValue:
|
||||
rjmp SGP40_MeasureRawSignal
|
||||
|
||||
appReportSensorsSgp40SendValue:
|
||||
rjmp SGP40_SendTVOC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MODULES_SGP30
|
||||
appReportSensorsSgp30SendValue1:
|
||||
rjmp SGP30_SendTVOC
|
||||
|
||||
appReportSensorsSgp30SendValue2:
|
||||
rjmp SGP30_SendCO2
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MODULES_CCS811
|
||||
appReportSensorsCcs811SendValue1:
|
||||
rjmp CCS811_SendTVOC
|
||||
|
||||
appReportSensorsCcs811SendValue2:
|
||||
rjmp CCS811_SendCO2
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MODULES_BRIGHTNESS
|
||||
appReportSensorsBrightnessSendValue:
|
||||
rjmp Brightness_Send
|
||||
#endif
|
||||
|
||||
#ifdef APPS_DOOR
|
||||
appReportSensorsDoorSendValue:
|
||||
rjmp appDoorSendValue
|
||||
#endif
|
||||
|
||||
#ifdef APPS_MOTION
|
||||
appReportSensorsMotionSendValue:
|
||||
rjmp appMotionSendValue
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; table
|
||||
; time routine (word address)
|
||||
|
||||
appReportSensorsTable:
|
||||
#ifdef MODULES_SI7021
|
||||
.dw 1, appReportSensorsSi7021MeasureValue1
|
||||
.dw 11, appReportSensorsSi7021MeasureValue2
|
||||
.dw 16, appReportSensorsSi7021SendValue1
|
||||
.dw 21, appReportSensorsSi7021SendValue2
|
||||
#endif
|
||||
#ifdef MODULES_MULTIFAN
|
||||
.dw 32, appReportSensorsMultiFanSendValue1
|
||||
.dw 33, appReportSensorsMultiFanSendValue2
|
||||
.dw 34, appReportSensorsMultiFanSendValue3
|
||||
#endif
|
||||
#ifdef MODULES_SGP40
|
||||
.dw 53, appReportSensorsSgp40MeasureValue
|
||||
.dw 63, appReportSensorsSgp40SendValue
|
||||
#endif
|
||||
#ifdef MODULES_SGP30
|
||||
.dw 53, appReportSensorsSgp30SendValue1
|
||||
.dw 63, appReportSensorsSgp30SendValue2
|
||||
#endif
|
||||
#ifdef MODULES_DS18B20
|
||||
.dw 84, appReportSensorsDs18b20SendValue
|
||||
#endif
|
||||
#ifdef MODULES_CCS811
|
||||
.dw 94, appReportSensorsCcs811SendValue1
|
||||
.dw 104, appReportSensorsCcs811SendValue2
|
||||
#endif
|
||||
#ifdef MODULES_BRIGHTNESS
|
||||
.dw 97, appReportSensorsBrightnessSendValue
|
||||
#endif
|
||||
#ifdef APPS_DOOR
|
||||
.dw 100, appReportSensorsDoorSendValue
|
||||
#endif
|
||||
#ifdef APPS_MOTION
|
||||
.dw 108, appReportSensorsMotionSendValue
|
||||
#endif
|
||||
; end of table
|
||||
.dw 0, 0
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user