ota toegevoegd, altijd beginnen op wit
This commit is contained in:
parent
8e410e616e
commit
b200b97f1a
@ -48,3 +48,9 @@ monitor_filters =
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
fastled/FastLED@^3.7.0
|
fastled/FastLED@^3.7.0
|
||||||
knolleary/PubSubClient@^2.8
|
knolleary/PubSubClient@^2.8
|
||||||
|
|
||||||
|
|
||||||
|
[env:esp32c3_supermini_network]
|
||||||
|
extends = env:esp32c3_supermini
|
||||||
|
upload_protocol = espota
|
||||||
|
upload_port = 10.206.0.101
|
||||||
@ -179,6 +179,10 @@ bool Hanglamp::isOn(){
|
|||||||
|
|
||||||
void Hanglamp::turnOn(){
|
void Hanglamp::turnOn(){
|
||||||
if(!this->on){
|
if(!this->on){
|
||||||
|
|
||||||
|
this->colorIndex = 1;
|
||||||
|
setColor(colorTable[1]);
|
||||||
|
|
||||||
FastLED.setBrightness(this->brightness);
|
FastLED.setBrightness(this->brightness);
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
this->setOn(true);
|
this->setOn(true);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ PubSubClient client(espClient);
|
|||||||
|
|
||||||
std::vector<SubscribedChannel> * channels = new std::vector<SubscribedChannel>();
|
std::vector<SubscribedChannel> * channels = new std::vector<SubscribedChannel>();
|
||||||
|
|
||||||
char mqtt_server[40] = "manus";
|
char mqtt_server[40] = "10.206.0.175";
|
||||||
char mqtt_port[6] = "1883";
|
char mqtt_port[6] = "1883";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
44
src/OTA.cpp
Normal file
44
src/OTA.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include "OTA.h"
|
||||||
|
|
||||||
|
#include <ArduinoOTA.h>
|
||||||
|
|
||||||
|
void OTA_setup(){
|
||||||
|
ArduinoOTA
|
||||||
|
.onStart([]() {
|
||||||
|
String type;
|
||||||
|
if (ArduinoOTA.getCommand() == U_FLASH) {
|
||||||
|
type = "sketch";
|
||||||
|
} else { // U_SPIFFS
|
||||||
|
type = "filesystem";
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
|
||||||
|
Serial.println("Start updating " + type);
|
||||||
|
})
|
||||||
|
.onEnd([]() {
|
||||||
|
Serial.println("\nEnd");
|
||||||
|
})
|
||||||
|
.onProgress([](unsigned int progress, unsigned int total) {
|
||||||
|
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
|
||||||
|
})
|
||||||
|
.onError([](ota_error_t error) {
|
||||||
|
Serial.printf("Error[%u]: ", error);
|
||||||
|
if (error == OTA_AUTH_ERROR) {
|
||||||
|
Serial.println("Auth Failed");
|
||||||
|
} else if (error == OTA_BEGIN_ERROR) {
|
||||||
|
Serial.println("Begin Failed");
|
||||||
|
} else if (error == OTA_CONNECT_ERROR) {
|
||||||
|
Serial.println("Connect Failed");
|
||||||
|
} else if (error == OTA_RECEIVE_ERROR) {
|
||||||
|
Serial.println("Receive Failed");
|
||||||
|
} else if (error == OTA_END_ERROR) {
|
||||||
|
Serial.println("End Failed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ArduinoOTA.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OTA_loop(){
|
||||||
|
ArduinoOTA.handle();
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#define INCLUDE_LED
|
#define INCLUDE_LED
|
||||||
#define ENABLE_MQTT
|
#define ENABLE_MQTT
|
||||||
// #define ENABLE_OTA
|
#define ENABLE_OTA
|
||||||
#define ENABLE_WIFI
|
#define ENABLE_WIFI
|
||||||
// #define ENABLE_FS
|
// #define ENABLE_FS
|
||||||
// #define ENABLE_PINFINDER
|
// #define ENABLE_PINFINDER
|
||||||
|
|||||||
@ -16,6 +16,11 @@
|
|||||||
#include "Wifi.h"
|
#include "Wifi.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef ENABLE_OTA
|
||||||
|
#include "OTA.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
#include "MQTT.h"
|
#include "MQTT.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user