added testcases / a bit refactored
This commit is contained in:
@@ -71,20 +71,27 @@ void CheckRule(uint16_t deviceId, uint8_t dt, uint8_t state, Rule *rule)
|
||||
if (rule->toggle)
|
||||
pinState = (currentPinState->getPinState(rule->targetMeyPinId) ^ true);
|
||||
|
||||
|
||||
SendDoTriggerSwitchCanPackage(rule->targetDevId, rule->targetMeyPinId, pinState);
|
||||
// //digitalWrite(foundPinId->pin_id, pinState);
|
||||
// //foundPinId->pin_state = pinState;
|
||||
//
|
||||
currentPinState->setPinState(rule->targetMeyPinId, pinState);
|
||||
|
||||
|
||||
|
||||
BroadcastTriggerMeyPinCanPackage(rule->targetDevId, rule->targetMeyPinId, pinState);
|
||||
currentPinState->setPinState(rule->targetMeyPinId, pinState);
|
||||
}
|
||||
|
||||
void HandleTriggered(can_frame *frame)
|
||||
{
|
||||
if (GetPackageType(frame->can_id) == SWITCH_TRIGGERED_CAN_ID)
|
||||
{
|
||||
RemotePinInfo *currentPinState = remotePinInfo.FindOrAdd(GetDeviceId(frame->can_id) );
|
||||
|
||||
if (currentPinState == NULL)
|
||||
return;
|
||||
|
||||
currentPinState->setPinState(frame->data[0], frame->data[1]);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleRules(can_frame *frame)
|
||||
{
|
||||
HandleTriggered(frame);
|
||||
|
||||
if (rules == NULL) return;
|
||||
if (GetPackageType(frame->can_id) == SWITCH_TRIGGERED_CAN_ID)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user