Regenerating PPM signal based on distances from ultrasonic sensors, ESP8266 for connectin via wifi. Autonomous quadcopter behaviour, autonomou height holding. Flying direction based on front and back ultrasonic sensors.
Dependencies: ConfigFile HCSR04 PID PPM2 mbed-rtos mbed
Diff: hardware.h
- Branch:
- DistanceRegulation
- Revision:
- 15:9cdf757269fb
- Parent:
- 14:076ef843e1ba
- Child:
- 16:9490bb68e1fb
diff -r 076ef843e1ba -r 9cdf757269fb hardware.h --- a/hardware.h Fri Oct 27 14:59:21 2017 +0000 +++ b/hardware.h Fri Oct 27 15:29:51 2017 +0000 @@ -35,7 +35,9 @@ char* _str = new char[1024]; +char* _serverMessage = new char[1024]; bool pidChanged = false; +// zero is default value float _P = 0; float _I = 0; float _D = 0; @@ -62,13 +64,19 @@ void writeSettingsToConfig(void){ ConvertToCharArray(_P); - _configFile.setValue("P", _str); + if(!_configFile.setValue("P", _str)) + strcat(_serverMessage, "P value could not be saved to configFile\n\r"); ConvertToCharArray(_I); - _configFile.setValue("I", _str); + if(!_configFile.setValue("I", _str)) + strcat(_serverMessage, "I value could not be saved to configFile\n\r"); ConvertToCharArray(_D); - _configFile.setValue("D", _str); + if(!_configFile.setValue("D", _str)) + strcat(_serverMessage, "D value could not be saved to configFile\n\r"); ConvertToCharArray(_groundSetPoint); - _configFile.setValue("groundSetPoint", _str); + if(!_configFile.setValue("groundSetPoint", _str)){ + strcat(_serverMessage, "groundSetPoint value could not be saved to configFile\n\r"); + pc.printf("groundSetPoint value could not be saved to configFile\n\r"); + } _configFile.write("/local/config.cfg");