From: Lukáš Jiřiště Date: Mon, 18 Nov 2024 10:03:13 +0000 (+0100) Subject: Change pwm_pin to control_pin X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=4fbd33e351d6c8bd66bbfb570dfb62f01de4e631;p=Servomatic.git Change pwm_pin to control_pin This is done because the Servo library does not use the PWM functionality of the digital pins for the servo control. I thought it does but it uses an inner timer for timing the pulses. --- diff --git a/CellValve.h b/CellValve.h index ada5a2e..0e71379 100644 --- a/CellValve.h +++ b/CellValve.h @@ -11,7 +11,7 @@ class CellValve : public Valve public: CellValve() = delete; CellValve(const CellValve &other) = delete; - CellValve(pin pwm_pin, int usec_opened, int usec_barely_opened, + CellValve(pin control_pin, int usec_opened, int usec_barely_opened, int isec_closed); ~CellValve(); diff --git a/CellValve.ino b/CellValve.ino index ad2c8b0..cdd69e5 100644 --- a/CellValve.ino +++ b/CellValve.ino @@ -1,8 +1,8 @@ #include "CellValve.h" -CellValve::CellValve(pin pwm_pin, int usec_opened, int usec_barely_opened, +CellValve::CellValve(pin control_pin, int usec_opened, int usec_barely_opened, int usec_closed) - : Valve{pwm_pin, usec_opened, usec_closed} + : Valve{control_pin, usec_opened, usec_closed} , m_usec_barely_opened{usec_barely_opened} { } diff --git a/Valve.h b/Valve.h index 9ae0a8a..be9dab2 100644 --- a/Valve.h +++ b/Valve.h @@ -21,7 +21,7 @@ class Valve public: Valve() = delete; Valve(const Valve &other) = delete; - Valve(pin pwm_pin, int usec_opened, int isec_closed); + Valve(pin control_pin, int usec_opened, int isec_closed); ~Valve(); Valve &operator=(const Valve &other) = delete; diff --git a/Valve.ino b/Valve.ino index 1c18584..ba64d27 100644 --- a/Valve.ino +++ b/Valve.ino @@ -1,12 +1,12 @@ #include "Valve.h" -Valve::Valve(pin pwm_pin, int usec_opened, int usec_closed) +Valve::Valve(pin control_pin, int usec_opened, int usec_closed) : m_servo{} , m_usec_opened{usec_opened} , m_usec_closed{usec_closed} , m_usec_current{usec_closed} { - m_servo.attach(pwm_pin); + m_servo.attach(control_pin); update_pos(); }