mirror of
https://github.com/jwetzell/LumixStick.git
synced 2026-09-10 08:29:29 +00:00
Add network connection icon
This commit is contained in:
+14
-21
@@ -1,10 +1,6 @@
|
|||||||
#include <M5StickC.h>
|
#include <M5StickC.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
#include <WebServer.h>
|
#include <WebServer.h>
|
||||||
|
|
||||||
#include <FS.h>
|
|
||||||
#include <SPIFFS.h>
|
|
||||||
#include "Lumix.h"
|
#include "Lumix.h"
|
||||||
|
|
||||||
// Put your wifi SSID and password here
|
// Put your wifi SSID and password here
|
||||||
@@ -41,45 +37,42 @@ void handleSave(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleNotFound() {
|
|
||||||
String message = "File Not Found\n\n";
|
|
||||||
message += "URI: ";
|
|
||||||
message += server.uri();
|
|
||||||
message += "\nMethod: ";
|
|
||||||
message += (server.method() == HTTP_GET) ? "GET" : "POST";
|
|
||||||
message += "\nArguments: ";
|
|
||||||
message += server.args();
|
|
||||||
message += "\n";
|
|
||||||
for (uint8_t i = 0; i < server.args(); i++) {
|
|
||||||
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
|
|
||||||
}
|
|
||||||
server.send(404, "text/plain", message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the setup routine runs once when M5StickC starts up
|
// the setup routine runs once when M5StickC starts up
|
||||||
void setup(){
|
void setup(){
|
||||||
M5.begin();
|
M5.begin();
|
||||||
M5.Lcd.fillScreen(BLACK);
|
M5.Lcd.fillScreen(BLACK);
|
||||||
|
updateCameraStatusIndicator();
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
WiFi.begin(ssid,password);
|
WiFi.begin(ssid,password);
|
||||||
Serial.print("WiFi Connecting");
|
Serial.print("WiFi Connecting");
|
||||||
// Wait for connection
|
// Wait for connection
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
delay(100);
|
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
|
delay(250);
|
||||||
|
drawNetworkIcon(TFT_BLACK);
|
||||||
|
delay(250);
|
||||||
|
drawNetworkIcon(TFT_WHITE);
|
||||||
}
|
}
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.println("WiFi Connected - " + WiFi.localIP().toString());
|
Serial.println("WiFi Connected - " + WiFi.localIP().toString());
|
||||||
|
|
||||||
server.on("/", handleRoot);
|
server.on("/", handleRoot);
|
||||||
server.on("/save", handleSave);
|
server.on("/save", handleSave);
|
||||||
server.onNotFound(handleNotFound);
|
|
||||||
|
|
||||||
server.begin();
|
server.begin();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawNetworkIcon(uint32_t color){
|
||||||
|
M5.Lcd.drawLine(4, 16, 4, 14, color);
|
||||||
|
M5.Lcd.drawLine(7, 16, 7, 12, color);
|
||||||
|
M5.Lcd.drawLine(10, 16, 10, 10, color);
|
||||||
|
M5.Lcd.drawLine(13, 16, 13, 8, color);
|
||||||
|
M5.Lcd.drawLine(16, 16, 16, 6, color);
|
||||||
|
}
|
||||||
|
|
||||||
void updateCameraStatusIndicator(){
|
void updateCameraStatusIndicator(){
|
||||||
|
|
||||||
int circleRadius = 7;
|
int circleRadius = 7;
|
||||||
|
|||||||
Reference in New Issue
Block a user