mirror of
https://github.com/bendtherules/Patient-counter-esp8266.git
synced 2026-08-18 13:52:39 +00:00
Print IP info
This commit is contained in:
Binary file not shown.
@@ -4,3 +4,5 @@ void setupOTALocal();
|
|||||||
void handleOTALocal();
|
void handleOTALocal();
|
||||||
|
|
||||||
void handleOTARemote();
|
void handleOTARemote();
|
||||||
|
|
||||||
|
void printIPInfo();
|
||||||
|
|||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
#ifndef BUILD_NUMBER
|
#ifndef BUILD_NUMBER
|
||||||
#define BUILD_NUMBER 42
|
#define BUILD_NUMBER 47
|
||||||
#endif
|
#endif
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
#define VERSION "v0.1.42 - 2023-11-28 18:31:54.334129"
|
#define VERSION "v0.1.47 - 2023-11-28 18:50:16.207931"
|
||||||
#endif
|
#endif
|
||||||
#ifndef VERSION_SHORT
|
#ifndef VERSION_SHORT
|
||||||
#define VERSION_SHORT "v0.1.42"
|
#define VERSION_SHORT "v0.1.47"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ const String KEY_D = "0x1FE20DF";
|
|||||||
const String KEY_ON = "0x1FE48B7";
|
const String KEY_ON = "0x1FE48B7";
|
||||||
const String KEY_OFF = "0x1FE48B7";
|
const String KEY_OFF = "0x1FE48B7";
|
||||||
const String KEY_MODE = "0x1FE58A7";
|
const String KEY_MODE = "0x1FE58A7";
|
||||||
|
const String KEY_RPT = "0x1FE10EF";
|
||||||
|
|
||||||
|
|
||||||
char lastPressedKey = '\0';
|
char lastPressedKey = '\0';
|
||||||
@@ -118,6 +119,9 @@ void handleKeyPress(char pressedKey) {
|
|||||||
playBuzzer(BUZZER_PIN, TONE_BEEP_TWICE);
|
playBuzzer(BUZZER_PIN, TONE_BEEP_TWICE);
|
||||||
handleOTARemote();
|
handleOTARemote();
|
||||||
}
|
}
|
||||||
|
if (pressedKey == 'I') {
|
||||||
|
printIPInfo();
|
||||||
|
}
|
||||||
// If pressed number
|
// If pressed number
|
||||||
uint8_t currentNumberEntered = pressedKey - '0';
|
uint8_t currentNumberEntered = pressedKey - '0';
|
||||||
uint8_t lastNumberEntered = lastPressedKey - '0';
|
uint8_t lastNumberEntered = lastPressedKey - '0';
|
||||||
@@ -208,6 +212,8 @@ void loop() {
|
|||||||
pressedKey = 'R';
|
pressedKey = 'R';
|
||||||
} else if (hexKey == KEY_MODE) {
|
} else if (hexKey == KEY_MODE) {
|
||||||
pressedKey = 'U';
|
pressedKey = 'U';
|
||||||
|
} else if (hexKey == KEY_RPT) {
|
||||||
|
pressedKey = 'I';
|
||||||
}
|
}
|
||||||
if (pressedKey != '\0') {
|
if (pressedKey != '\0') {
|
||||||
handleKeyPress(pressedKey);
|
handleKeyPress(pressedKey);
|
||||||
|
|||||||
+21
-6
@@ -11,9 +11,11 @@
|
|||||||
|
|
||||||
void setupOTALocal() {
|
void setupOTALocal() {
|
||||||
Serial.println("Booting");
|
Serial.println("Booting");
|
||||||
char infoBuffer[LCD_COLUMNS];
|
{
|
||||||
sprintf(infoBuffer, "W:%s", WIFI_SSID);
|
char infoBuffer[LCD_COLUMNS];
|
||||||
showInsideInfo(infoBuffer);
|
sprintf(infoBuffer, "W:%s", WIFI_SSID);
|
||||||
|
showInsideInfo(infoBuffer);
|
||||||
|
}
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
||||||
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
|
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
|
||||||
@@ -33,9 +35,11 @@ void setupOTALocal() {
|
|||||||
});
|
});
|
||||||
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
|
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
|
||||||
Serial.printf("Progress:%u%%\r", (progress / (total / 100)));
|
Serial.printf("Progress:%u%%\r", (progress / (total / 100)));
|
||||||
char infoBuffer[LCD_COLUMNS];
|
{
|
||||||
sprintf(infoBuffer, "LU:P:%u%%", (progress / (total / 100)));
|
char infoBuffer[LCD_COLUMNS];
|
||||||
showInsideInfo(infoBuffer);
|
sprintf(infoBuffer, "LU:P:%u%%", (progress / (total / 100)));
|
||||||
|
showInsideInfo(infoBuffer);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
ArduinoOTA.onError([](ota_error_t error) {
|
ArduinoOTA.onError([](ota_error_t error) {
|
||||||
Serial.printf("Error[%u]:", error);
|
Serial.printf("Error[%u]:", error);
|
||||||
@@ -44,11 +48,22 @@ void setupOTALocal() {
|
|||||||
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect 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_RECEIVE_ERROR) Serial.println("Receive Failed");
|
||||||
else if (error == OTA_END_ERROR) Serial.println("End Failed");
|
else if (error == OTA_END_ERROR) Serial.println("End Failed");
|
||||||
|
showInsideInfo("LU:Failed");
|
||||||
});
|
});
|
||||||
ArduinoOTA.begin();
|
ArduinoOTA.begin();
|
||||||
Serial.println("Ready");
|
Serial.println("Ready");
|
||||||
Serial.print("IP address:");
|
Serial.print("IP address:");
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
|
showInsideInfo("Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
void printIPInfo() {
|
||||||
|
String localIPStr = WiFi.localIP().toString();
|
||||||
|
char localIP[LCD_COLUMNS];
|
||||||
|
localIPStr.toCharArray(localIP, LCD_COLUMNS);
|
||||||
|
char infoBuffer[LCD_COLUMNS];
|
||||||
|
sprintf(infoBuffer, "W:%s", localIP);
|
||||||
|
showInsideInfo(infoBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleOTALocal() {
|
void handleOTALocal() {
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
42
|
47
|
||||||
Reference in New Issue
Block a user