diff options
author | Jakob Stendahl <jakob.stendahl@outlook.com> | 2021-02-10 10:56:36 +0100 |
---|---|---|
committer | Jakob Stendahl <jakob.stendahl@outlook.com> | 2021-02-10 10:56:36 +0100 |
commit | 318d850719a86d58012689143c01dd0edb6263b5 (patch) | |
tree | ef253d25d31e4fb429a57a3d1deb3d8f52e483e7 /source/HoverBitController.h | |
parent | f308eb46365a0e8b490e7fa371a53d72a1f41852 (diff) | |
download | hoverbit-ble-318d850719a86d58012689143c01dd0edb6263b5.tar.gz hoverbit-ble-318d850719a86d58012689143c01dd0edb6263b5.zip |
:sprakles: Add failsafe code (addressing #5)
Diffstat (limited to 'source/HoverBitController.h')
-rw-r--r-- | source/HoverBitController.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/HoverBitController.h b/source/HoverBitController.h index 4963cd1..477e96e 100644 --- a/source/HoverBitController.h +++ b/source/HoverBitController.h @@ -27,7 +27,9 @@ DEALINGS IN THE SOFTWARE. #include <MicroBit.h> -#define BATTERY_LOW_LIMIT 3500 +#define BATTERY_LOW_LIMIT 3500 +#define FSAFE_TLIM_THROTTLE 1000 // When to cut the throttle +#define FSAFE_TLIM_ARM 5000 // When to disarm class HoverBitController { private: @@ -40,16 +42,17 @@ class HoverBitController { int pitch; int yaw; int throttle; - int failSafeC; + unsigned long receiveTime; bool mainController; bool batteryEmpty; int batteryMilliVolt; float batteryFactor; + bool failSafe(void); + public: void init(MicroBit* _uBit); - void failSafe(void); unsigned int getBatteryVoltage(void); void AirBit(int Pitch,int Arm,int Roll,int Throttle,int Yaw,int Aux1,int Aux2); void HoverControl(); |