From 6af08d0ad6eed27efa3a6c23e4c60c7fa67b2a32 Mon Sep 17 00:00:00 2001 From: Mike Melancon Date: Wed, 11 Oct 2023 21:51:33 -0500 Subject: [PATCH 1/2] Change hidden password string to abide by minimum length --- FluidNC/src/Settings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FluidNC/src/Settings.cpp b/FluidNC/src/Settings.cpp index d5ff38135..3794f07bf 100644 --- a/FluidNC/src/Settings.cpp +++ b/FluidNC/src/Settings.cpp @@ -262,10 +262,10 @@ static bool isPassword(bool (*_checker)(char*)) { const char* StringSetting::getDefaultString() { // If the string is a password do not display it - return (_checker && isPassword(_checker)) ? "******" : _defaultValue.c_str(); + return (_checker && isPassword(_checker)) ? "********" : _defaultValue.c_str(); } const char* StringSetting::getStringValue() { - return (_checker && isPassword(_checker)) ? "******" : get(); + return (_checker && isPassword(_checker)) ? "********" : get(); } void StringSetting::addWebui(WebUI::JSONencoder* j) { From 2250d6c2ce0d6e7b2aba77cc609addf2aab6d2b3 Mon Sep 17 00:00:00 2001 From: bdring Date: Sat, 11 Nov 2023 09:59:48 -0600 Subject: [PATCH 2/2] Added auto update to channels. I just copied the code from the commit mitch did to the uart extender branch. --- FluidNC/src/OLED.cpp | 2 +- FluidNC/src/OLED.h | 2 ++ FluidNC/src/Status_outputs.cpp | 6 +++--- FluidNC/src/Status_outputs.h | 10 +++++----- FluidNC/src/UartChannel.cpp | 1 + FluidNC/src/UartChannel.h | 8 ++++++-- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/FluidNC/src/OLED.cpp b/FluidNC/src/OLED.cpp index e65eacb7f..7e0192af7 100644 --- a/FluidNC/src/OLED.cpp +++ b/FluidNC/src/OLED.cpp @@ -81,7 +81,7 @@ void OLED::init() { _oled->display(); allChannels.registration(this); - setReportInterval(500); + setReportInterval(_report_interval_ms); } Channel* OLED::pollLine(char* line) { diff --git a/FluidNC/src/OLED.h b/FluidNC/src/OLED.h index 833b4025a..9e299feca 100644 --- a/FluidNC/src/OLED.h +++ b/FluidNC/src/OLED.h @@ -42,6 +42,7 @@ class OLED : public Channel, public Configuration::Configurable { std::string _ticker; int _radio_delay = 0; + int _report_interval_ms = 500; uint8_t _i2c_num = 0; @@ -116,6 +117,7 @@ class OLED : public Channel, public Configuration::Configurable { void afterParse() override; void group(Configuration::HandlerBase& handler) override { + handler.item("report_interval_ms", _report_interval_ms, 100, 5000); handler.item("i2c_num", _i2c_num); handler.item("i2c_address", _address); handler.item("width", _width); diff --git a/FluidNC/src/Status_outputs.cpp b/FluidNC/src/Status_outputs.cpp index 2ed99b8f5..4f9b348dd 100644 --- a/FluidNC/src/Status_outputs.cpp +++ b/FluidNC/src/Status_outputs.cpp @@ -27,11 +27,11 @@ void Status_Outputs::init() { } log_info("Status outputs" - << " Interval:" << _interval_ms << " Idle:" << _Idle_pin.name() << " Cycle:" << _Run_pin.name() << " Hold:" << _Hold_pin.name() - << " Alarm:" << _Alarm_pin.name()); + << " Interval:" << _report_interval_ms << " Idle:" << _Idle_pin.name() << " Cycle:" << _Run_pin.name() + << " Hold:" << _Hold_pin.name() << " Alarm:" << _Alarm_pin.name()); allChannels.registration(this); - setReportInterval(_interval_ms); + setReportInterval(_report_interval_ms); } void Status_Outputs::parse_report() { diff --git a/FluidNC/src/Status_outputs.h b/FluidNC/src/Status_outputs.h index 793624288..1ef334ee7 100644 --- a/FluidNC/src/Status_outputs.h +++ b/FluidNC/src/Status_outputs.h @@ -17,7 +17,7 @@ class Status_Outputs : public Channel, public Configuration::Configurable { std::string _report; std::string _state; - int _interval_ms = 500; + int _report_interval_ms = 500; void parse_report(); void parse_status_report(); @@ -25,10 +25,10 @@ class Status_Outputs : public Channel, public Configuration::Configurable { public: Status_Outputs() : Channel("status_outputs") {} - Status_Outputs(const Status_Outputs&) = delete; - Status_Outputs(Status_Outputs&&) = delete; + Status_Outputs(const Status_Outputs&) = delete; + Status_Outputs(Status_Outputs&&) = delete; Status_Outputs& operator=(const Status_Outputs&) = delete; - Status_Outputs& operator=(Status_Outputs&&) = delete; + Status_Outputs& operator=(Status_Outputs&&) = delete; virtual ~Status_Outputs() = default; @@ -47,7 +47,7 @@ class Status_Outputs : public Channel, public Configuration::Configurable { void afterParse() override {}; void group(Configuration::HandlerBase& handler) override { - handler.item("report_interval_ms", _interval_ms, 100, 5000); + handler.item("report_interval_ms", _report_interval_ms, 100, 5000); handler.item("idle_pin", _Idle_pin); handler.item("run_pin", _Run_pin); handler.item("hold_pin", _Hold_pin); diff --git a/FluidNC/src/UartChannel.cpp b/FluidNC/src/UartChannel.cpp index f304f8802..b3cc42fce 100644 --- a/FluidNC/src/UartChannel.cpp +++ b/FluidNC/src/UartChannel.cpp @@ -16,6 +16,7 @@ void UartChannel::init() { } else { log_error("UartChannel: missing uart" << _uart_num); } + setReportInterval(_report_interval_ms); } void UartChannel::init(Uart* uart) { _uart = uart; diff --git a/FluidNC/src/UartChannel.h b/FluidNC/src/UartChannel.h index 94f9aec5f..30d03ce3a 100644 --- a/FluidNC/src/UartChannel.h +++ b/FluidNC/src/UartChannel.h @@ -12,7 +12,8 @@ class UartChannel : public Channel, public Configuration::Configurable { Lineedit* _lineedit; Uart* _uart; - int _uart_num = 0; + int _uart_num = 0; + int _report_interval_ms = 0; public: UartChannel(bool addCR = false); @@ -39,7 +40,10 @@ class UartChannel : public Channel, public Configuration::Configurable { Channel* pollLine(char* line) override; // Configuration methods - void group(Configuration::HandlerBase& handler) override { handler.item("uart_num", _uart_num); } + void group(Configuration::HandlerBase& handler) override { + handler.item("uart_num", _uart_num); + handler.item("report_interval_ms", _report_interval_ms); + } }; extern UartChannel Uart0;