version 1.0
Dependencies: CMSIS_DSP_401 GPS MPU9150_DMP PID QuaternionMath Servo mbed
Fork of SolarOnFoils_MainModule_20150518 by
Diff: systemVar.cpp
- Revision:
- 1:b4a0d63db637
- Parent:
- 0:81b21910454e
- Child:
- 2:f6d058931b17
--- a/systemVar.cpp Tue Jun 23 13:55:28 2015 +0000 +++ b/systemVar.cpp Fri Jun 26 09:21:33 2015 +0000 @@ -14,21 +14,37 @@ #include "menu.h" #include "systemVar.h" +////////////////////////////////////////////////////////////////////////////////////// +// Defines // +////////////////////////////////////////////////////////////////////////////////////// +#define EXT_UI_HEIGHT 1020 ////////////////////////////////////////////////////////////////////////////////////// // Contructor // ////////////////////////////////////////////////////////////////////////////////////// SystemVar::SystemVar() : uiCounter(0), + uivVarHeightFoilBorne(30), bError(0) - {}; + { + init(); + }; SystemVar::~SystemVar() { }; +extern Serial debug; +extern CAN CANbus; -extern Serial debug; +////////////////////////////////////////////////////////////////////////////////////// +// init // +////////////////////////////////////////////////////////////////////////////////////// +void SystemVar::init(void) +{ + //init here +} + ////////////////////////////////////////////////////////////////////////////////////// // set's // ////////////////////////////////////////////////////////////////////////////////////// @@ -57,6 +73,14 @@ uiPitch[1] = uiValue; } +void SystemVar::vVarHeightFoilBorne(uint32_t uiValue) +{ + cMessage = uiValue; + CANbus.write(CANMessage(EXT_UI_HEIGHT, &cMessage, 1)); + uivVarHeightFoilBorne = uiValue; + debug.printf("set height %i\t", uivVarHeightFoilBorne); +} + void SystemVar::vSetPHeight(uint32_t uiValue) { uiPHeight = uiValue; @@ -102,6 +126,16 @@ return uiPitch[0]; } +uint32_t SystemVar::uiGetRoll(void) +{ + return uiRoll[1]; +} + +int32_t SystemVar::iGetHeightFoilBorne(void) +{ + return uivVarHeightFoilBorne; +} + ////////////////////////////////////////////////////////////////////////////////////// // show value // ////////////////////////////////////////////////////////////////////////////////////// @@ -129,14 +163,15 @@ void SystemVar::cShowValue(VALUE_t v) { value = v; - //debug.printf("SW case %i\t", uiRoll[1]); switch(value) { case _ROLL: itoa(uiRoll[1], cValue); break; case _PITCH: itoa(uiPitch[1], cValue); break; + case _HEIGHTFOILBORNE: itoa(uivVarHeightFoilBorne, cValue); break; + case _PHEIGHT: itoa(uiPHeight, cValue); break; } // end switch