NOT FINISHED YET!!! My first try to get a self built fully working Quadrocopter based on an mbed, a self built frame and some other more or less cheap parts.
Diff: RC/RC_Channel.cpp
- Revision:
- 29:8b7362a2ee14
- Parent:
- 28:ba6ca9f4def4
- Child:
- 34:3aa1cbcde59d
diff -r ba6ca9f4def4 -r 8b7362a2ee14 RC/RC_Channel.cpp --- a/RC/RC_Channel.cpp Sat Dec 01 07:13:04 2012 +0000 +++ b/RC/RC_Channel.cpp Sat Dec 15 08:42:36 2012 +0000 @@ -7,7 +7,7 @@ time = -100; // start value to see if there was any value yet loadCalibrationValue(&scale, "SCALE"); - loadCalibrationValue(&offset, "OFFSET"); + loadCalibrationValue(&offset, "OFFSE"); myinterrupt.rise(this, &RC_Channel::rise); myinterrupt.fall(this, &RC_Channel::fall); @@ -16,6 +16,8 @@ int RC_Channel::read() { + if(time == -100) + return time; return scale * (float)(time) + offset; // calibration of the readings } @@ -55,7 +57,7 @@ void RC_Channel::loadCalibrationValue(float * value, char * fileextension) { char path[40]; - sprintf(path, "/local/FlyBed/RC_%d_%s", index, fileextension); + sprintf(path, "/local/RC%d%s", index, fileextension); FILE *fp = fopen(path, "r"); if (fp != NULL) { fscanf(fp, "%f", value);