; *************************************************************************** ; copyright : (C) 2024 by Martin Preuss ; email : martin@libchipcard.de ; ; *************************************************************************** ; * This file is part of the project "AqHome". * ; * Please see toplevel file COPYING of that project for license details. * ; *************************************************************************** ; - check motion ; - motion detected? ; - yes: ; - set motion HW bit ; - reset motion timeout counter ; - SW bit set? ; - no: ; - report motion ; - reset motionReportTimeout (use lower value to repeat motion message once) ; - set motion SW bit ; - yes ; - dec motionReportTimeout ; - 0? ; - report current SW state ; - reset motionReportTimeout (use higher value since motion should already be known) ; - no: ; - clear motion hw bit ; - dec motionTimeout ; - 0? ; - yes: ; - clear SW motion bit ; - report no motion .equ MOTION_STATE_MOTION_HW_BIT = 0 .equ MOTION_STATE_MOTION_SW_BIT = 1 .dseg motionDataBegin: motionState: .byte 1 motionTimeout: .byte 1 motionReportTimeout: .byte 1 motionDataEnd: .cseg Motion_Init: Motion_Fini: Motion_Run: Motion_Every100ms: ret