ls -l implement and ota fw fix
This commit is contained in:
1 parent
b696703d45
commit
6596346d3d
6 files changed
+83
-52
No files matched your search
+36
-24
@@ -87,6 +87,10 @@ void setup_webserver() {
|
||||
server.on("/", handleRootGz);
|
||||
server.on("/style.css", handleCssGz);
|
||||
server.on("/favicon.png", handleFaviconGz);
|
||||
// void serveStatic(const char* uri, fs::FS& fs, const char* path, const char* cache_header = NULL );
|
||||
|
||||
server.serveStatic("/static", LittleFS, "/tt.html");
|
||||
|
||||
server.onNotFound(handleNotFound);
|
||||
|
||||
server.begin();
|
||||
@@ -152,15 +156,15 @@ uint8_t onoff = 1;
|
||||
void ledsequence(uint8_t direction, uint8_t onoff, uint8_t factor);
|
||||
uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval, uint8_t factor);
|
||||
|
||||
uint8_t flag = 0;
|
||||
void timer_callback(void *pArg)
|
||||
{
|
||||
*((int *) pArg) += 1;
|
||||
|
||||
ledsequence(direction, onoff, 4);
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setup() {
|
||||
#ifdef WITH_DEBUGGING_ON
|
||||
Serial.begin(460800);
|
||||
@@ -173,8 +177,9 @@ void setup() {
|
||||
|
||||
mount_fs();
|
||||
//format_fs();
|
||||
listDir("");
|
||||
readFile("/test.txt");
|
||||
ls("/");
|
||||
ls("tester/");
|
||||
// readFile("/test.txt");
|
||||
|
||||
pinMode(NODEMCU_LED, OUTPUT);
|
||||
pinMode(ESP12_LED, OUTPUT);
|
||||
@@ -191,6 +196,23 @@ void setup() {
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Serial.println("");
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(ssid);
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
os_timer_setfn(&timer1, timer_callback, &timer_arg);
|
||||
os_timer_arm(&timer1, 1000, true);
|
||||
|
||||
Serial.println("Ready");
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
setup_ota();
|
||||
|
||||
pinMode(led, OUTPUT);
|
||||
digitalWrite(led, 0);
|
||||
Serial.println("");
|
||||
@@ -200,21 +222,6 @@ void setup() {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
}
|
||||
|
||||
Serial.println("");
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(ssid);
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
os_timer_setfn(&timer1, timer_callback, &timer_arg);
|
||||
os_timer_arm(&timer1, 1, true);
|
||||
|
||||
Serial.println("Ready");
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
setup_ota();
|
||||
setup_webserver();
|
||||
setup_pwm_pca9685();
|
||||
}
|
||||
@@ -301,9 +308,9 @@ void ledsequence(uint8_t direction, uint8_t onoff, uint8_t factor){
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t t;
|
||||
uint32_t _t=0;
|
||||
#define SP_US(_str,_a) Serial.print(_str); Serial.print(" took: "); Serial.print(_a); Serial.println("us")
|
||||
#define TIMEIF_US(_str,_f, _l) t=micros(); _f; t=micros()-t; if(t > _l) { SP_US(_str, t); }
|
||||
#define TIMEIF_US(_f, _l, _str) _t=micros(); _f; _t=micros()-_t; if(_t > _l) { SP_US(_str, _t); }
|
||||
|
||||
void loop() {
|
||||
if(millis() - dimmtimer > 2){
|
||||
@@ -313,9 +320,14 @@ void loop() {
|
||||
if(millis() > 25000 && onoff == 1 && direction == 1) onoff = 0;
|
||||
if(millis() > 35000 && direction == 1){
|
||||
onoff = 1;
|
||||
direction = 0;
|
||||
direction = 0;
|
||||
}
|
||||
TIMEIF_US("OTA", ArduinoOTA.handle(), 1000);
|
||||
TIMEIF_US("HTTP", server.handleClient(), 1000);
|
||||
TIMEIF_US(ArduinoOTA.handle(), 1000, "OTA");
|
||||
TIMEIF_US(server.handleClient(), 1000, "HTTP");
|
||||
|
||||
if(flag) {
|
||||
flag = 0;
|
||||
ledsequence(direction, onoff, 4);
|
||||
Serial.printf("[%lu] interrupt\n\r", millis());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user