From 7a3921fea8b8268d3d61cd00f9b3d89e9d8e30b7 Mon Sep 17 00:00:00 2001 From: Jim Morris Date: Mon, 5 Mar 2018 14:52:40 +0000 Subject: [PATCH] fix up some style issues in the laser PR --- src/modules/tools/laser/Laser.cpp | 2 +- src/modules/tools/laser/Laser.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/tools/laser/Laser.cpp b/src/modules/tools/laser/Laser.cpp index 117cd9e7..bcdb01ce 100644 --- a/src/modules/tools/laser/Laser.cpp +++ b/src/modules/tools/laser/Laser.cpp @@ -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 diff --git a/src/modules/tools/laser/Laser.h b/src/modules/tools/laser/Laser.h index 65395aee..003202a6 100644 --- a/src/modules/tools/laser/Laser.h +++ b/src/modules/tools/laser/Laser.h @@ -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 }; -- 2.20.1