on and normal mode finally work

This commit is contained in:
2023-11-15 11:31:57 +01:00
parent 193c45ee33
commit bd74b95ffd
13 changed files with 152 additions and 2569 deletions

@@ -22,8 +22,7 @@ class FreshSupvHandler : public FreshDeviceHandlerBase {
enum OpCode { DEFAULT_OPERATION = 0, PARSE_TM = 1 };
FreshSupvHandler(DhbConfig cfg, CookieIF* comCookie, Gpio uartIsolatorSwitch,
PowerSwitchIF& switchIF, power::Switch_t powerSwitch,
PlocSupvUartManager& supvHelper);
PowerSwitchIF& switchIF, power::Switch_t powerSwitch);
/**
* Periodic helper executed function, implemented by child class.
*/
@@ -82,7 +81,7 @@ class FreshSupvHandler : public FreshDeviceHandlerBase {
enum class ShutdownState : uint8_t { IDLE, POWER_SWITCHING };
ShutdownState shutdownState = ShutdownState::IDLE;
PlocSupvUartManager uartManager;
PlocSupvUartManager* uartManager;
CookieIF* comCookie;
PowerSwitchIF& switchIF;
power::Switch_t switchId;
@@ -114,7 +113,8 @@ class FreshSupvHandler : public FreshDeviceHandlerBase {
pwrctrl::EnablePl enablePl = pwrctrl::EnablePl(objects::POWER_CONTROLLER);
struct ActiveCmdInfo {
ActiveCmdInfo(uint32_t cmdCountdownMs) : cmdCountdown(cmdCountdownMs) {}
ActiveCmdInfo(DeviceCommandId_t commandId, uint32_t cmdCountdownMs)
: commandId(commandId), cmdCountdown(cmdCountdownMs) {}
DeviceCommandId_t commandId = DeviceHandlerIF::NO_COMMAND_ID;
bool isPending = false;
@@ -132,14 +132,16 @@ class FreshSupvHandler : public FreshDeviceHandlerBase {
// Map for Action commands. For normal commands, a separate static structure will be used.
std::map<uint32_t, ActiveCmdInfo> activeActionCmds;
std::array<uint8_t, supv::MAX_COMMAND_SIZE> commandBuffer;
std::array<uint8_t, supv::MAX_COMMAND_SIZE> commandBuffer{};
SpacePacketCreator creator;
supv::TcParams spParams = supv::TcParams(creator);
ReturnValue_t parseTmPackets();
ReturnValue_t sendCommand(TcBase& tc, bool replyPacketExpected, uint32_t cmdCountdownMs = 1000);
ReturnValue_t sendEmptyCmd(uint16_t apid, uint8_t serviceId, bool replyPacketExpected);
ReturnValue_t sendCommand(DeviceCommandId_t commandId, TcBase& tc, bool replyPacketExpected,
uint32_t cmdCountdownMs = 1000);
ReturnValue_t sendEmptyCmd(DeviceCommandId_t commandId, uint16_t apid, uint8_t serviceId,
bool replyPacketExpected);
ReturnValue_t prepareSelBootImageCmd(const uint8_t* commandData);
ReturnValue_t prepareSetTimeRefCmd();
ReturnValue_t prepareSetBootTimeoutCmd(const uint8_t* commandData, size_t cmdDataLen);