Files
cariflex/tools/EVerest-main/lib/everest/fsm/examples/light_switch/states.hpp
Eric F d398a6ced2 Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1)
- OpenOCPP extracted (firmware OCPP 1.6J/2.0.1)
- ShapeShifter library installed (pip install -e)
- ShapeShifter specification extracted
- EVerest extracted

TODO updated with progress
2026-06-08 00:38:27 -04:00

64 lines
1.3 KiB
C++

// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 - 2023 Pionix GmbH and Contributors to EVerest
#ifndef STATES_HPP
#define STATES_HPP
#include "fsm.hpp"
struct LightOff : public SimpleState {
using SimpleState::SimpleState;
void enter() final {
ctx.set_brightness(0);
}
HandleEventReturnType handle_event(AllocatorType&, Event) final;
};
struct LightOn : public SimpleState {
using SimpleState::SimpleState;
void enter() final {
ctx.set_brightness(current_brightness);
}
HandleEventReturnType handle_event(AllocatorType&, Event) final;
private:
int current_brightness{1};
};
struct MotionMode : public CompoundState {
using CompoundState::CompoundState;
HandleEventReturnType handle_event(AllocatorType&, Event) final;
};
struct MotionIdle : public SimpleState {
using SimpleState::SimpleState;
void enter() final {
ctx.set_brightness(0);
}
HandleEventReturnType handle_event(AllocatorType&, Event) final;
};
struct MotionDetected : public SimpleState {
using SimpleState::SimpleState;
void enter() final {
ctx.set_brightness(3);
}
HandleEventReturnType handle_event(AllocatorType&, Event) final;
CallbackReturnType callback() final;
private:
static const int TIMEOUT_MS = 3000;
bool timeout_started{false};
};
#endif // STATES_HPP