From 318d850719a86d58012689143c01dd0edb6263b5 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Wed, 10 Feb 2021 10:56:36 +0100 Subject: :sprakles: Add failsafe code (addressing #5) --- source/HoverBitController.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source/HoverBitController.h') 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 -#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(); -- cgit v1.2.3