浏览代码

added OPTIONS parameter

first bit allows for forcing arm status to true
Roel Schiphorst 3 年之前
父节点
当前提交
9a24a3e7d8
共有 3 个文件被更改,包括 10 次插入0 次删除
  1. 5 0
      RemoteIDModule/RemoteIDModule.ino
  2. 1 0
      RemoteIDModule/parameters.cpp
  3. 4 0
      RemoteIDModule/parameters.h

+ 5 - 0
RemoteIDModule/RemoteIDModule.ino

@@ -283,6 +283,11 @@ static void set_data(Transport &t)
     t.set_parse_fail(reason);
 
     arm_check_ok = (reason==nullptr);
+
+    if (g.options & OPTIONS_FORCE_ARM_OK) {
+        arm_check_ok = true;
+    }
+
     led.set_state(pfst_check_ok && arm_check_ok? Led::LedState::ARM_OK : Led::LedState::ARM_FAIL);
 
     uint32_t now_ms = millis();

+ 1 - 0
RemoteIDModule/parameters.cpp

@@ -37,6 +37,7 @@ const Parameters::Param Parameters::params[] = {
     { "PUBLIC_KEY4",       Parameters::ParamType::CHAR64, (const void*)&g.public_keys[3], },
     { "PUBLIC_KEY5",       Parameters::ParamType::CHAR64, (const void*)&g.public_keys[4], },
     { "MAVLINK_SYSID",     Parameters::ParamType::UINT8,  (const void*)&g.mavlink_sysid,    0, 0, 254 },
+    { "OPTIONS",           Parameters::ParamType::UINT8,  (const void*)&g.options,          0, 0, 254 },
     { "DONE_INIT",         Parameters::ParamType::UINT8,  (const void*)&g.done_init,        0, 0, 0, PARAM_FLAG_HIDDEN},
     { "",                  Parameters::ParamType::NONE,   nullptr,  },
 };

+ 4 - 0
RemoteIDModule/parameters.h

@@ -35,6 +35,7 @@ public:
     char wifi_ssid[21] = "";
     char wifi_password[21] = "ArduRemoteID";
     uint8_t wifi_channel = 6;
+    uint8_t options;
     struct {
         char b64_key[64];
     } public_keys[MAX_PUBLIC_KEYS];
@@ -100,4 +101,7 @@ private:
     void load_defaults(void);
 };
 
+// bits for OPTIONS parameter
+#define OPTIONS_FORCE_ARM_OK 1U<<0
+
 extern Parameters g;