2011

Dependencies:   mbed FastPWM

Files at this revision

API Documentation at this revision

Comitter:
Lightvalve
Date:
Mon Aug 01 09:49:00 2022 +0000
Parent:
243:1ba0cc8fee52
Commit message:
220801

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1ba0cc8fee52 -r 8586c11b4c30 main.cpp
--- a/main.cpp	Fri Jul 29 07:11:58 2022 +0000
+++ b/main.cpp	Mon Aug 01 09:49:00 2022 +0000
@@ -1310,14 +1310,21 @@
                             valve_pos_pulse = -10000.0f;
                         }
                     }
-                    float valve_control_deadzone = 5.0f;
-                    if(valve_pos_pulse < valve_control_deadzone && valve_pos_pulse > -valve_control_deadzone) {
-                        valve_pos.ref = ((float) VALVE_DEADZONE_PLUS + (float) VALVE_DEADZONE_MINUS) * 0.5f;
-                    } else if (valve_pos_pulse >= valve_control_deadzone) {
+//                    float valve_control_deadzone = 5.0f;
+//                    if(valve_pos_pulse < valve_control_deadzone && valve_pos_pulse > -valve_control_deadzone) {
+//                        valve_pos.ref = ((float) VALVE_DEADZONE_PLUS + (float) VALVE_DEADZONE_MINUS) * 0.5f;
+//                    } else if (valve_pos_pulse >= valve_control_deadzone) {
+//                        valve_pos.ref = valve_pos_pulse/10000.0f * ((float) VALVE_MAX_POS - (float) VALVE_DEADZONE_PLUS) + (float) VALVE_DEADZONE_PLUS;
+//                    } else {
+//                        valve_pos.ref = -valve_pos_pulse/10000.0f * ((float) VALVE_MIN_POS - (float) VALVE_DEADZONE_MINUS) + (float) VALVE_DEADZONE_MINUS;
+//                    }
+                    
+                    if (valve_pos_pulse >= 0) {
                         valve_pos.ref = valve_pos_pulse/10000.0f * ((float) VALVE_MAX_POS - (float) VALVE_DEADZONE_PLUS) + (float) VALVE_DEADZONE_PLUS;
                     } else {
                         valve_pos.ref = -valve_pos_pulse/10000.0f * ((float) VALVE_MIN_POS - (float) VALVE_DEADZONE_MINUS) + (float) VALVE_DEADZONE_MINUS;
-                    }
+                    } 
+
                     VALVE_POS_CONTROL_DZ(valve_pos.ref);
                     V_out = Vout.ref;
                 }