New version of quadcopter software written to OO principles
Dependencies: mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS
Diff: Status/Status.h
- Revision:
- 2:969dfa4f2436
- Parent:
- 0:c6a85bb2a827
- Child:
- 3:4823d6750629
diff -r ec3521d90369 -r 969dfa4f2436 Status/Status.h --- a/Status/Status.h Wed Mar 04 18:53:43 2015 +0000 +++ b/Status/Status.h Wed Apr 01 11:19:21 2015 +0000 @@ -1,13 +1,15 @@ #include "mbed.h" +#include "Global.h" +#include "StatusLights.h" #ifndef Status_H #define Status_H -class Status // begin declaration of the class +class Status { - public: // begin public section - Status(); // constructor - ~Status(); // destructor + public: + Status(); + ~Status(); enum State { @@ -17,17 +19,20 @@ MANUAL, STABILISED, AUTO, - ABORT, - EMG_LAND, - EMG_OFF, - GROUND_ERROR + ERROR }; enum FlightMode { RATE, - STAB, - NOT_SET + STAB + }; + + enum NavigationMode + { + NONE, + ALTITUDE_HOLD, + POSITION_HOLD }; enum BaseStationMode @@ -36,40 +41,52 @@ PID_OUTPUTS, IMU_OUTPUTS, STATUS, - MAPPED_RC, + RC, PID_TUNING, GPS, ZERO, RATE_TUNING, STAB_TUNING, ALTITUDE, - VELOCITY + VELOCITY, + ALTITUDE_STATUS }; - bool initialise(); - bool setState(State state); + bool update(); State getState(); bool setFlightMode(FlightMode flightMode); FlightMode getFlightMode(); + bool setNavigationMode(NavigationMode navigationMode); + NavigationMode getNavigationMode(); bool setBaseStationMode(BaseStationMode baseStationMode); BaseStationMode getBaseStationMode(); - bool setBatteryLevel(float batteryLevel); - float getBatteryLevel(); + bool setBatteryLevel(double batteryLevel); + double getBatteryLevel(); bool setArmed(bool armed); bool getArmed(); bool setInitialised(bool initialised); bool getInitialised(); bool setRcConnected(bool rcConnected); bool getRcConnected(); + bool setMotorsSpinning(bool flying); + bool getMotorsSpinning(); + bool setDeadZone(bool flying); + bool getDeadZone(); private: State _state; - FlightMode _flightMode; + FlightMode _flightMode; + NavigationMode _navigationMode; BaseStationMode _baseStationMode; - float _batteryLevel; + StatusLights _statusLights; + bool setState(State state); + void flash(); + double _batteryLevel; bool _armed; bool _initialised; bool _rcConnected; + bool _flying; + bool _deadZone; }; #endif \ No newline at end of file