diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-09-04 15:19:31 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-09-04 15:19:31 +0300 |
commit | 8c2493dfa96ad79b746dea22c3ca134533d892a8 (patch) | |
tree | 0b9c2fdfb56970e70a30e940cecf338590029b99 /src/Fans/LocalFan.cpp | |
parent | 103b92930887cc65787f75a435e0301dbfa1b847 (diff) |
Remote fans now workig
Also implemented request message ID allocation and response checking
Diffstat (limited to 'src/Fans/LocalFan.cpp')
-rw-r--r-- | src/Fans/LocalFan.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/Fans/LocalFan.cpp b/src/Fans/LocalFan.cpp index 6cae9fea..02684019 100644 --- a/src/Fans/LocalFan.cpp +++ b/src/Fans/LocalFan.cpp @@ -34,14 +34,22 @@ LocalFan::~LocalFan() tachoPort.Release(); } -void LocalFan::AppendPortDetails(const StringRef& str) const +GCodeResult LocalFan::ReportPortDetails(const StringRef& str) const { + str.printf("Fan %u", fanNumber); port.AppendDetails(str); if (tachoPort.IsValid()) { str.cat(" tacho"); tachoPort.AppendDetails(str); } + return GCodeResult::ok; +} + +GCodeResult LocalFan::SetPwmFrequency(PwmFrequency freq, const StringRef& reply) +{ + port.SetFrequency(freq); + return GCodeResult::ok; } // Set the hardware PWM @@ -58,7 +66,7 @@ void LocalFan::SetHardwarePwm(float pwmVal) // Refresh the fan PWM // If you want make sure that the PWM is definitely updated, set lastPWM negative before calling this -void LocalFan::Refresh() +void LocalFan::InternalRefresh() { float reqVal; #if HAS_SMART_DRIVERS @@ -153,9 +161,15 @@ void LocalFan::Refresh() lastVal = reqVal; } +GCodeResult LocalFan::Refresh(const StringRef& reply) +{ + InternalRefresh(); + return GCodeResult::ok; +} + bool LocalFan::UpdateFanConfiguration(const StringRef& reply) { - Refresh(); + InternalRefresh(); return true; } @@ -163,7 +177,7 @@ bool LocalFan::Check() { if (sensorsMonitored != 0 || blipping) { - Refresh(); + InternalRefresh(); } return sensorsMonitored != 0 && lastVal != 0.0; } @@ -187,7 +201,7 @@ bool LocalFan::AssignPorts(const char *pinNames, const StringRef& reply) tachoPort.AttachInterrupt(FanInterrupt, INTERRUPT_MODE_FALLING, this); } - Refresh(); + InternalRefresh(); return true; } |