Code for 'Smart Regulator' featured in 'Model Engineer', November 2020 on. Contains all work to August 2020 including all code described. Top level algorithm development is quite spares, leaving some work for you! Any questions - jon@jons-workshop.com
Dependencies: mbed BufferedSerial Servo2 PCT2075 I2CEeprom FastPWM
Diff: rpm.cpp
- Revision:
- 5:6ca3e7ffc553
- Parent:
- 3:43cb067ecd00
--- a/rpm.cpp Fri Aug 07 13:06:03 2020 +0000 +++ b/rpm.cpp Sat Dec 05 12:40:17 2020 +0000 @@ -18,7 +18,7 @@ // microsecs.reset () ; // timer = 0 // microsecs.start () ; // 64 bit, counts micro seconds and times out in half million years servo_position = MIN_WORKING_THROTTLE; - Speed_Control (MIN_WORKING_THROTTLE); + Set_Speed_Lever (MIN_WORKING_THROTTLE); }; void Engine_Manager::magneto_timeoutC () @@ -75,7 +75,7 @@ return (uint32_t)filtered_measured_RPM; } -void Engine_Manager::Speed_Control (double th) // Make this private once all throttle refs local +void Engine_Manager::Set_Speed_Lever (double th) // Make this private once all throttle refs local { if (user_settings.rd(SERVO_DIR) == 0) Speed_ControlServo = th; @@ -91,13 +91,13 @@ if (!rpm_in_run_range) { // Transition from idle to working revs rpm_in_run_range = true; servo_position = MIN_WORKING_THROTTLE; // set throttle to probably somewhere near low useful revs - Speed_Control (MIN_WORKING_THROTTLE); + Set_Speed_Lever (MIN_WORKING_THROTTLE); } // Endof transition from idle to working revs } // Endof Runnable or make runnable else { // requested rpm are below useful, so kill engine if (rpm_in_run_range) { // detect transition from useful work to idle servo_position = 0.0; - Speed_Control (0.0); + Set_Speed_Lever (0.0); rpm_in_run_range = false; } } @@ -148,7 +148,7 @@ servo_position = MIN_WORKING_THROTTLE; if (servo_position > MAX_WORKING_THROTTLE) servo_position = MAX_WORKING_THROTTLE; - Speed_Control (servo_position); // Update signal to engine throttle control servo + Set_Speed_Lever (servo_position); // Update signal to engine throttle control servo } break; default: