瀏覽代碼

RemoteIDModule.ino: properly set the bt4 sending period depending on the number of bt4 states

Dusan Zivkovic 3 年之前
父節點
當前提交
1dd1c352a2
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      RemoteIDModule/RemoteIDModule.ino

+ 2 - 1
RemoteIDModule/RemoteIDModule.ino

@@ -393,8 +393,9 @@ void loop()
     }
     }
 
 
     static uint32_t last_update_bt4_ms;
     static uint32_t last_update_bt4_ms;
+    int bt4_states = UAS_data.BasicIDValid[1] ? 7 : 6;
     if (g.bt4_rate > 0 &&
     if (g.bt4_rate > 0 &&
-        now_ms - last_update_bt4_ms > 200/g.bt4_rate) {
+        now_ms - last_update_bt4_ms > (1000.0f/(bt4_states - 1))/g.bt4_rate) {
         last_update_bt4_ms = now_ms;
         last_update_bt4_ms = now_ms;
         ble.transmit_legacy(UAS_data);
         ble.transmit_legacy(UAS_data);
     }
     }