fix up some style issues in the laser PR
authorJim Morris <morris@wolfman.com>
Mon, 5 Mar 2018 14:52:40 +0000 (14:52 +0000)
committerJim Morris <morris@wolfman.com>
Mon, 5 Mar 2018 14:52:40 +0000 (14:52 +0000)
src/modules/tools/laser/Laser.cpp
src/modules/tools/laser/Laser.h

index 117cd9e..bcdb01c 100644 (file)
@@ -247,7 +247,7 @@ uint32_t Laser::set_proportional_power(uint32_t dummy)
 {
     if(manual_fire) {
         // If we have fire duration set
-        if (fire_duration) {
+        if (fire_duration > 0) {
             // Decrease it each ms
             fire_duration -= ms_per_tick;
             // And if it turned 0, disable laser and manual fire mode
index 65395ae..003202a 100644 (file)
@@ -43,13 +43,14 @@ class Laser : public Module{
         float laser_minimum_power; // value used to tickle the laser on moves.  Also minimum value for auto-scaling
         float laser_maximum_s_value; // Value of S code that will represent max power
         float scale;
+        int32_t fire_duration; // manual fire command duration
+        int32_t ms_per_tick; // ms between each ticks, depends on PWM frequency
+
         struct {
             bool laser_on:1;      // set if the laser is on
             bool pwm_inverting:1; // stores whether the PWM period should be inverted
-            bool ttl_used:1;           // stores whether we have a TTL output
+            bool ttl_used:1;        // stores whether we have a TTL output
             bool ttl_inverting:1;   // stores whether the TTL output should be inverted
             bool manual_fire:1;     // set when manually firing
         };
-        int32_t fire_duration; // manual fire command duration
-        int32_t ms_per_tick; // ms between each ticks, depends on PWM frequency
 };