From 9063962c7d4e71e6cca727d02269955e5b06c235 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Mon, 5 May 2025 21:03:13 +0200 Subject: [PATCH] avr/apps/ma_light: adapted to latest changes. works now. --- avr/apps/ma_light/README | 46 ++++++++++++++++++++++++++++++++++++++ avr/apps/ma_light/main.asm | 2 +- avr/apps/ma_light/recv.asm | 12 +++++----- 3 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 avr/apps/ma_light/README diff --git a/avr/apps/ma_light/README b/avr/apps/ma_light/README new file mode 100644 index 0000000..ba66cc5 --- /dev/null +++ b/avr/apps/ma_light/README @@ -0,0 +1,46 @@ + +App for Motion Activated Light +============================== +============================== + + +1. Values +====== + +1.1 MALRGBWVALUE +---------------- + +RGB Value for activated light: + aqhome-tool setValue -N nodes/XXXXXXXX/MALRGBWVALUE -v GRWB + +Example: + Set color of LED strip to blue (half intensity) + aqhome-tool setValue -N nodes/12345678/MALRGBWVALUE -v 0x80 + + +1.2 MALONTIME +------------- +On-Time after activation: + aqhome-tool setValue -N nodes/XXXXXXXX/MALONTIME TIME_IN_1/10_SECS + +Example: + Keep light on after activation for 20 seconds + aqhome-tool setValue -N nodes/12345678/MALONTIME -v 200 + + +1.3. MALSOURCE1, MALSOURCE2 +--------------------------- + +Sources for Motion Messages: + aqhome-tool setValue -N nodes/XXXXXXXX/MALSOURCE1 -v VVNN + aqhome-tool setValue -N nodes/XXXXXXXX/MALSOURCE2 -v VVNN + + VVNN is a 16-bit value, lower 8 bit contain the source node address, higher 8 bit contain the + value id to react to. + +Example: + React to value report messages with value id 7 from node with address 2 + aqhome-tool setValue -N nodes/12345678/MALSOURCE1 -v 0x0702 + + + diff --git a/avr/apps/ma_light/main.asm b/avr/apps/ma_light/main.asm index d0ce081..0edeef7 100644 --- a/avr/apps/ma_light/main.asm +++ b/avr/apps/ma_light/main.asm @@ -205,7 +205,7 @@ appMotionLightReadConfFromEeprom_end: ; --------------------------------------------------------------------------- ; @routine appMotionLightWriteConfToEeprom ; -; @clobbers r15, r16, r17, X +; @clobbers r16, r17, X appMotionLightWriteConfToEeprom: push r15 diff --git a/avr/apps/ma_light/recv.asm b/avr/apps/ma_light/recv.asm index 1df3aad..aebda82 100644 --- a/avr/apps/ma_light/recv.asm +++ b/avr/apps/ma_light/recv.asm @@ -64,7 +64,7 @@ AppMotionLight_OnPacketReceived_set: AppMotionLight_OnPacketReceived_clcRet: clc ; unexpected message ret -AppMotionLight_OnPacketReceived_setRGBW: +AppMotionLight_OnPacketReceived_setRGBW: ; "setValue nodes/XXXXXXXX/MALRGBWVALUE GRWB" sts appMotionLightColor, r18 sts appMotionLightColor+1, r19 sts appMotionLightColor+2, r20 @@ -72,25 +72,23 @@ AppMotionLight_OnPacketReceived_setRGBW: rcall appMotionLightStartTimer ; immediately ON with new color (r16) rcall appMotionLightTurnOn ; (r16, r17, r18, r19, r20, r21, r23) rjmp AppMotionLight_OnPacketReceived_sendAck -AppMotionLight_OnPacketReceived_setOnTime: +AppMotionLight_OnPacketReceived_setOnTime: ; "setValue nodes/XXXXXXXX/MALONTIME n" (n in 1/10 secs) sts appMotionLightOnTime, r18 sts appMotionLightOnTime+1, r19 rjmp AppMotionLight_OnPacketReceived_sendAck -AppMotionLight_OnPacketReceived_setSource1: +AppMotionLight_OnPacketReceived_setSource1: ; setValue "nodes/XXXXXXXX/MALSOURCE1 0xVVNN" (VV=value id, NN=node addr) sts appMotionLightSources, r18 ; peerAddr sts appMotionLightSources+1, r19 ; valueId rjmp AppMotionLight_OnPacketReceived_sendAck -AppMotionLight_OnPacketReceived_setSource2: +AppMotionLight_OnPacketReceived_setSource2: ; setValue "nodes/XXXXXXXX/MALSOURCE2 0xVVNN" (VV=value id, NN=node addr) sts appMotionLightSources+APP_MOTIONLIGHT_SOURCE_SIZE, r18 ; peerAddr sts appMotionLightSources+APP_MOTIONLIGHT_SOURCE_SIZE+1, r19 ; valueId AppMotionLight_OnPacketReceived_sendAck: push xl push xh - mov r16, r22 ; src address ldi r23, NETMSG_CMD_VALUE_SET_ACK - clr r17 rcall Main_SendValueResponse ; (clobbers all, including Y) - rcall appMotionLightWriteConfToEeprom + rcall appMotionLightWriteConfToEeprom ; (r16, r17, X) pop xh pop xl sec