Make ip be uint32 instead of strings

This commit is contained in:
Rune Harlyk
2026-01-03 20:48:15 +01:00
committed by nikguin04
parent 6be38b2e9e
commit d611cd043b
13 changed files with 156 additions and 131 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ esp_err_t APService::getStatus(PsychicRequest *request) {
void APService::status(JsonObject &root) {
root["status"] = getAPNetworkStatus();
root["ip_address"] = WiFi.softAPIP().toString();
root["ip_address"] = (uint32_t)(WiFi.softAPIP());
root["mac_address"] = WiFi.softAPmacAddress();
root["station_num"] = WiFi.softAPgetStationNum();
}
+4 -8
View File
@@ -19,8 +19,6 @@ esp_err_t handleSleep(PsychicRequest *request) {
return request->reply(200);
}
void reset() {
ESP_LOGI(TAG, "Resetting device");
File root = ESP_FS.open(FS_CONFIG_DIRECTORY);
@@ -73,25 +71,23 @@ void sleep() {
ESP_LOGI(TAG, "Setting device to sleep");
}
void getStaticSystemInformation(socket_message_StaticSystemInformation &info) {
size_t fs_total = 0, fs_used = 0;
esp_littlefs_info("spiffs", &fs_total, &fs_used);
info.esp_platform = (char*) ESP_PLATFORM_NAME;
info.esp_platform = (char *)ESP_PLATFORM_NAME;
info.firmware_version = APP_VERSION;
info.cpu_freq_mhz = ESP.getCpuFreqMHz();
info.cpu_type = (char*) ESP.getChipModel();
info.cpu_type = (char *)ESP.getChipModel();
info.cpu_rev = ESP.getChipRevision();
info.cpu_cores = ESP.getChipCores();
info.sketch_size = ESP.getSketchSize();
info.free_sketch_space = ESP.getFreeSketchSpace();
info.sdk_version = (char*) ESP.getSdkVersion();
info.sdk_version = (char *)ESP.getSdkVersion();
info.arduino_version = ARDUINO_VERSION;
info.flash_chip_size = ESP.getFlashChipSize();
info.flash_chip_speed = ESP.getFlashChipSpeed();
info.cpu_reset_reason = (char*) resetReason(esp_reset_reason());
info.cpu_reset_reason = (char *)resetReason(esp_reset_reason());
}
void getAnalytics(socket_message_AnalyticsData &analytics) {
+5 -5
View File
@@ -91,21 +91,21 @@ void WiFiService::getNetworkStatus(JsonObject &root) {
wl_status_t status = WiFi.status();
root["status"] = (uint8_t)status;
if (status == WL_CONNECTED) {
root["local_ip"] = WiFi.localIP().toString();
root["local_ip"] = (uint32_t)(WiFi.localIP());
root["mac_address"] = WiFi.macAddress();
root["rssi"] = WiFi.RSSI();
root["ssid"] = WiFi.SSID();
root["bssid"] = WiFi.BSSIDstr();
root["channel"] = WiFi.channel();
root["subnet_mask"] = WiFi.subnetMask().toString();
root["gateway_ip"] = WiFi.gatewayIP().toString();
root["subnet_mask"] = (uint32_t)(WiFi.subnetMask());
root["gateway_ip"] = (uint32_t)(WiFi.gatewayIP());
IPAddress dnsIP1 = WiFi.dnsIP(0);
IPAddress dnsIP2 = WiFi.dnsIP(1);
if (dnsIP1 != IPAddress(0, 0, 0, 0)) {
root["dns_ip_1"] = dnsIP1.toString();
root["dns_ip_1"] = (uint32_t)(dnsIP1);
}
if (dnsIP2 != IPAddress(0, 0, 0, 0)) {
root["dns_ip_2"] = dnsIP2.toString();
root["dns_ip_2"] = (uint32_t)(dnsIP2);
}
}
}