From 38cb996db652786e82e70cdd4a88b815e25a1ca1 Mon Sep 17 00:00:00 2001 From: Hugo Jean Ponsin Date: Mon, 24 Aug 2026 11:21:35 +0200 Subject: [PATCH] adding unit command --- CMakeLists.txt | 1 - src/device/power_switch.cpp | 4 +++- src/device/power_switch.h | 2 +- src/device/power_switch_config.h | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77207cc..fe84376 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,6 @@ set_property( CXX_STANDARD 17 ) - target_include_directories( power_switch_scfe PUBLIC diff --git a/src/device/power_switch.cpp b/src/device/power_switch.cpp index 2ca5518..0de5b7d 100644 --- a/src/device/power_switch.cpp +++ b/src/device/power_switch.cpp @@ -45,7 +45,9 @@ void powerSwitch::HandlePeriodic() { TMFeResult powerSwitch::HandleInit(const std::vector &args) { midas::odb o = { - {SETTING_DIR.c_str(), {{EDITABLE_VARNAME.c_str(), COMMAND_VARNAME}}}, + {SETTING_DIR.c_str(), + {{EDITABLE_VARNAME.c_str(), COMMAND_VARNAME}, + {UNIT_VARNAME.c_str(), UNIT_VALUE.c_str()}}}, {VARIABLES_DIR.c_str(), {{COMMAND_VARNAME.c_str(), {""}}, {READBACK_VARNAME.c_str(), {""}}}} diff --git a/src/device/power_switch.h b/src/device/power_switch.h index b45f0f0..a9013b0 100644 --- a/src/device/power_switch.h +++ b/src/device/power_switch.h @@ -14,7 +14,7 @@ class powerSwitch : public TMFeEquipment { private: std::vector outlets; mEpicsCa outletNumberRecord; - int numberOfOutlet; + int numberOfOutlet = 0; std::string equipmentPath; void updateOutletNumber(); int gracePeriod = 10; diff --git a/src/device/power_switch_config.h b/src/device/power_switch_config.h index 4d9bfd5..6034130 100644 --- a/src/device/power_switch_config.h +++ b/src/device/power_switch_config.h @@ -10,6 +10,8 @@ const std::string VARIABLES_DIR = "Variables"; const std::string SETTING_DIR = "Settings"; const std::string COMMAND_VARNAME = "Command"; const std::string READBACK_VARNAME = "Readback"; +const std::string UNIT_VARNAME = "Unit Command"; +const std::string UNIT_VALUE = "0=OFF, 1=ON, 2=RESTART"; const std::string SLASH = "/";