A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol
C arduinobluetoothcan-busdebuggingeepromesp32flipperzerogpiohardware-hackingi2cjtagopenocdprotocolspwmradiorfidspisubghzuartwifi
add view methods for brightness
Geo88914b23c9ec
diff --git a/src/Interfaces/IDeviceView.h b/src/Interfaces/IDeviceView.hindex 65b64d68..0173fcc4 100644--- a/src/Interfaces/IDeviceView.h+++ b/src/Interfaces/IDeviceView.h@@ -41,6 +41,12 @@ public:// Set screen rotationvirtual void setRotation(uint8_t rotation) = 0;+ // Set screen brightness+ virtual void setBrightness(uint8_t brightness) = 0;++ // Get screen brightness+ virtual uint8_t getBrightness() = 0;+// Display a main titlevirtual void topBar(const std::string& title, bool submenu, bool searchBar) = 0;diff --git a/src/Views/M5DeviceView.cpp b/src/Views/M5DeviceView.cppindex 9d4df546..ebb59cc3 100644--- a/src/Views/M5DeviceView.cpp+++ b/src/Views/M5DeviceView.cpp@@ -196,6 +196,14 @@ void M5DeviceView::setRotation(uint8_t rotation) {M5.Lcd.setRotation(rotation);}+void M5DeviceView::setBrightness(uint8_t brightness) {+ M5.Lcd.setBrightness(brightness);+}++uint8_t M5DeviceView::getBrightness() {+ return M5.Lcd.getBrightness();+}+void M5DeviceView::showModeName(std::string& mode, int y) {auto modeName = "Mode: " + mode;int16_t titleX = (M5.Lcd.width() - M5.Lcd.textWidth(modeName.c_str())) / 2;diff --git a/src/Views/M5DeviceView.h b/src/Views/M5DeviceView.hindex 0fa2493d..080e107f 100644--- a/src/Views/M5DeviceView.h+++ b/src/Views/M5DeviceView.h@@ -33,6 +33,8 @@ public:void loading() override;void clear() override;void setRotation(uint8_t rotation);+ void setBrightness(uint8_t brightness) override;+ uint8_t getBrightness() override;void topBar(const std::string& title, bool submenu, bool searchBar) override;void drawLogicTrace(uint8_t pin, const std::vector<uint8_t>& buffer, uint8_t step) override;void drawAnalogicTrace(uint8_t pin, const std::vector<uint8_t>& buffer, uint8_t step) override;diff --git a/src/Views/NoScreenDeviceView.cpp b/src/Views/NoScreenDeviceView.cppindex 017993b0..b3311d83 100644--- a/src/Views/NoScreenDeviceView.cpp+++ b/src/Views/NoScreenDeviceView.cpp@@ -22,6 +22,12 @@ void NoScreenDeviceView::drawAnalogicTrace(uint8_t pin, const std::vector<uint8_void NoScreenDeviceView::setRotation(uint8_t rotation) {}+void NoScreenDeviceView::setBrightness(uint8_t brightness) {}++uint8_t NoScreenDeviceView::getBrightness() {+ return 0;+}+void NoScreenDeviceView::topBar(const std::string& title, bool submenu, bool searchBar) {}void NoScreenDeviceView::horizontalSelection(diff --git a/src/Views/NoScreenDeviceView.h b/src/Views/NoScreenDeviceView.hindex 75298c75..9ffdd285 100644--- a/src/Views/NoScreenDeviceView.h+++ b/src/Views/NoScreenDeviceView.h@@ -16,6 +16,8 @@ public:void drawLogicTrace(uint8_t pin, const std::vector<uint8_t>& buffer, uint8_t step) override;void drawAnalogicTrace(uint8_t pin, const std::vector<uint8_t>& buffer, uint8_t step) override;void setRotation(uint8_t rotation) override;+ void setBrightness(uint8_t brightness) override;+ uint8_t getBrightness() override;void topBar(const std::string& title, bool submenu, bool searchBar) override;void horizontalSelection(const std::vector<std::string>& options,diff --git a/src/Views/TembedDeviceView.cpp b/src/Views/TembedDeviceView.cppindex d9a2d306..a08eb852 100644--- a/src/Views/TembedDeviceView.cpp+++ b/src/Views/TembedDeviceView.cpp@@ -150,6 +150,14 @@ void TembedDeviceView::setRotation(uint8_t rotation) {tft.setRotation(rotation);}+void TembedDeviceView::setBrightness(uint8_t brightness) {+ tft.setBrightness(brightness);+}++uint8_t TembedDeviceView::getBrightness() {+ return tft.getBrightness();+}+void TembedDeviceView::topBar(const std::string& title, bool submenu, bool searchBar) {tft.setTextColor(TFT_GREEN, TFT_BLACK);tft.setTextSize(2);diff --git a/src/Views/TembedDeviceView.h b/src/Views/TembedDeviceView.hindex 2e74c469..5d6947a2 100644--- a/src/Views/TembedDeviceView.h+++ b/src/Views/TembedDeviceView.h@@ -55,6 +55,8 @@ public:void drawLogicTrace(uint8_t pin, const std::vector<uint8_t>& buffer, uint8_t step) override;void drawAnalogicTrace(uint8_t pin, const std::vector<uint8_t>& buffer, uint8_t step) override;void setRotation(uint8_t rotation) override;+ void setBrightness(uint8_t brightness) override;+ uint8_t getBrightness() override;void topBar(const std::string& title, bool submenu, bool searchBar) override;void horizontalSelection(const std::vector<std::string>& options,