Override identifier

This commit is contained in:
Blaz Kristan
2024-01-14 17:38:29 +01:00
parent 3f21b4aa7d
commit 45dc5e236d
11 changed files with 148 additions and 149 deletions

View File

@@ -187,7 +187,7 @@ class BobLightUsermod : public Usermod {
public:
void setup() {
void setup() override {
uint16_t totalLights = bottom + left + top + right;
if ( totalLights > strip.getLengthTotal() ) {
DEBUG_PRINTLN(F("BobLight: Too many lights."));
@@ -202,14 +202,14 @@ class BobLightUsermod : public Usermod {
initDone = true;
}
void connected() {
void connected() override {
// we can only start server when WiFi is connected
if (!bob) bob = new WiFiServer(bobPort, 1);
bob->begin();
bob->setNoDelay(true);
}
void loop() {
void loop() override {
if (!enabled || strip.isUpdating()) return;
if (millis() - lastTime > 10) {
lastTime = millis();
@@ -225,7 +225,7 @@ class BobLightUsermod : public Usermod {
* topic only contains stripped topic (part after /wled/MAC)
* topic should look like: /swipe with amessage of [up|down]
*/
bool onMqttMessage(char* topic, char* payload) {
bool onMqttMessage(char* topic, char* payload) override {
//if (strlen(topic) == 6 && strncmp_P(topic, PSTR("/subtopic"), 6) == 0) {
// String action = payload;
// if (action == "on") {
@@ -242,7 +242,7 @@ class BobLightUsermod : public Usermod {
/**
* subscribe to MQTT topic for controlling usermod
*/
void onMqttConnect(bool sessionPresent) {
void onMqttConnect(bool sessionPresent) override {
//char subuf[64];
//if (mqttDeviceTopic[0] != 0) {
// strcpy(subuf, mqttDeviceTopic);
@@ -252,7 +252,7 @@ class BobLightUsermod : public Usermod {
}
#endif
void addToJsonInfo(JsonObject& root)
void addToJsonInfo(JsonObject& root) override
{
JsonObject user = root["u"];
if (user.isNull()) user = root.createNestedObject("u");
@@ -273,7 +273,7 @@ class BobLightUsermod : public Usermod {
* addToJsonState() can be used to add custom entries to the /json/state part of the JSON API (state object).
* Values in the state object may be modified by connected clients
*/
void addToJsonState(JsonObject& root)
void addToJsonState(JsonObject& root) override
{
}
@@ -281,7 +281,7 @@ class BobLightUsermod : public Usermod {
* readFromJsonState() can be used to receive data clients send to the /json/state part of the JSON API (state object).
* Values in the state object may be modified by connected clients
*/
void readFromJsonState(JsonObject& root) {
void readFromJsonState(JsonObject& root) override {
if (!initDone) return; // prevent crash on boot applyPreset()
bool en = enabled;
JsonObject um = root[FPSTR(_name)];
@@ -304,7 +304,7 @@ class BobLightUsermod : public Usermod {
}
}
void appendConfigData() {
void appendConfigData() override {
//oappend(SET_F("dd=addDropdown('usermod','selectfield');"));
//oappend(SET_F("addOption(dd,'1st value',0);"));
//oappend(SET_F("addOption(dd,'2nd value',1);"));
@@ -315,7 +315,7 @@ class BobLightUsermod : public Usermod {
oappend(SET_F("addInfo('BobLight:pct',1,'Depth of scan [%]');")); // 0 is field type, 1 is actual field
}
void addToConfig(JsonObject& root) {
void addToConfig(JsonObject& root) override {
JsonObject umData = root.createNestedObject(FPSTR(_name));
umData[FPSTR(_enabled)] = enabled;
umData[F("port")] = bobPort;
@@ -326,7 +326,7 @@ class BobLightUsermod : public Usermod {
umData[F("pct")] = pct;
}
bool readFromConfig(JsonObject& root) {
bool readFromConfig(JsonObject& root) override {
JsonObject umData = root[FPSTR(_name)];
bool configComplete = !umData.isNull();
@@ -355,11 +355,11 @@ class BobLightUsermod : public Usermod {
* Use this to blank out some LEDs or set them to a different color regardless of the set effect mode.
* Commonly used for custom clocks (Cronixie, 7 segment)
*/
void handleOverlayDraw() {
void handleOverlayDraw() override {
//strip.setPixelColor(0, RGBW32(0,0,0,0)) // set the first pixel to black
}
uint16_t getId() { return USERMOD_ID_BOBLIGHT; }
uint16_t getId() override { return USERMOD_ID_BOBLIGHT; }
};