mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 02:36:35 +00:00
add hostedOTA and info messages (#23675)
This commit is contained in:
parent
fc22688b5d
commit
6c699e9b95
@ -333,6 +333,7 @@
|
||||
#define D_CMND_UPGRADE "Upgrade"
|
||||
#define D_JSON_ONE_OR_GT "1 or >%s to upgrade"
|
||||
#define D_CMND_OTAURL "OtaUrl"
|
||||
#define D_CMND_HOSTEDOTA "HostedOta"
|
||||
#define D_CMND_SERIALLOG "SerialLog"
|
||||
#define D_CMND_SYSLOG "SysLog"
|
||||
#define D_CMND_FILELOG "FileLog"
|
||||
|
@ -62,6 +62,9 @@ const char kTasmotaCommands[] PROGMEM = "|" // No prefix
|
||||
#endif // ESP32
|
||||
|
||||
D_CMND_SETSENSOR "|" D_CMND_SENSOR "|" D_CMND_DRIVER "|" D_CMND_JSON "|" D_CMND_JSON_PP
|
||||
#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||
"|" D_CMND_HOSTEDOTA
|
||||
#endif //CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||
#endif //FIRMWARE_MINIMAL
|
||||
;
|
||||
|
||||
@ -111,6 +114,9 @@ void (* const TasmotaCommand[])(void) PROGMEM = {
|
||||
#endif // ESP32
|
||||
|
||||
&CmndSetSensor, &CmndSensor, &CmndDriver, &CmndJson, &CmndJsonPP
|
||||
#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||
, &CmdHostedOta
|
||||
#endif //CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||
#endif //FIRMWARE_MINIMAL
|
||||
};
|
||||
|
||||
@ -980,6 +986,9 @@ void CmndStatus(void)
|
||||
#endif
|
||||
",\"" D_JSON_COREVERSION "\":\"" ARDUINO_CORE_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\","
|
||||
"\"CpuFrequency\":%d,\"Hardware\":\"%s\""
|
||||
#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||
",\"HostedMCU\":{\"Hardware\":\"" CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET"\",\"Version\":\"%s\"}"
|
||||
#endif
|
||||
"%s}}"),
|
||||
TasmotaGlobal.version, TasmotaGlobal.image_name, GetCodeCores().c_str(), GetBuildDateAndTime().c_str()
|
||||
#ifdef ESP8266
|
||||
@ -987,6 +996,9 @@ void CmndStatus(void)
|
||||
#endif
|
||||
, ESP.getSdkVersion(),
|
||||
ESP.getCpuFreqMHz(), GetDeviceHardwareRevision().c_str(),
|
||||
#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||
GetHostedMCUFwVersion().c_str(),
|
||||
#endif
|
||||
GetStatistics().c_str());
|
||||
CmndStatusResponse(2);
|
||||
}
|
||||
@ -3097,4 +3109,11 @@ void CmndTouchThres(void) {
|
||||
}
|
||||
#endif // ESP32 SOC_TOUCH_VERSION_1 or SOC_TOUCH_VERSION_2
|
||||
|
||||
void CmdHostedOta() {
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
OTAHostedMCU(XdrvMailbox.data);
|
||||
}
|
||||
ResponseCmndDone();
|
||||
}
|
||||
|
||||
#endif // ESP32
|
||||
|
57
tasmota/tasmota_support/support_hosted_mcu.ino
Normal file
57
tasmota/tasmota_support/support_hosted_mcu.ino
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
support_hosted_mcu.ino - eeprom support for Tasmota
|
||||
|
||||
Copyright (C) 2025 Theo Arends & Christian Baars
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||
|
||||
#include "esp_hosted.h"
|
||||
#include "esp_hosted_api_types.h"
|
||||
#include "esp_hosted_ota.h"
|
||||
|
||||
String GetHostedMCUFwVersion()
|
||||
{
|
||||
if(!esp_hosted_is_config_valid()) {
|
||||
return String("");
|
||||
}
|
||||
esp_hosted_coprocessor_fwver_t ver_info;
|
||||
esp_err_t err = esp_hosted_get_coprocessor_fwversion(&ver_info);
|
||||
if (err == ESP_OK) {
|
||||
char data[40];
|
||||
snprintf_P(data, sizeof(data), PSTR("%d.%d.%d"), ver_info.major1,ver_info.minor1,ver_info.patch1);
|
||||
// AddLog(LOG_LEVEL_DEBUG, PSTR("Fw: %d.%d.%d"), ver_info.major1, ver_info.minor1, ver_info.patch1);
|
||||
return String(data);
|
||||
}
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("Err: %d, version 0.0..6 or older"), err);
|
||||
return String(PSTR("0.0.6")); // we can not know exactly, but API was added after 0.0.6
|
||||
}
|
||||
|
||||
void OTAHostedMCU(const char* image_url) {
|
||||
AddLog(LOG_LEVEL_INFO, PSTR("OTA: co-processor OTA update started from %s"), image_url);
|
||||
esp_err_t ret = esp_hosted_slave_ota(image_url);
|
||||
// next lines are questionable, because ATM the system will reboot immediately - maybe we would see the failure
|
||||
if (ret == ESP_OK) {
|
||||
AddLog(LOG_LEVEL_INFO, PSTR("OTA: co-processor OTA update successful !!"));
|
||||
} else {
|
||||
AddLog(LOG_LEVEL_INFO, PSTR("OTA: co-processor OTA update failed: %d"), ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED
|
@ -2977,6 +2977,11 @@ void HandleInformation(void) {
|
||||
WSContentSend_P(PSTR("}1" D_FRIENDLY_NAME " %d}2%s"), i +1, SettingsTextEscaped(SET_FRIENDLYNAME1 +i).c_str());
|
||||
}
|
||||
WSContentSeparatorIFat();
|
||||
#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||
WSContentSend_P(PSTR("}1 Hosted MCU }2 " CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET ""));
|
||||
WSContentSend_P(PSTR("}1 Hosted Remote Fw }2%s"), GetHostedMCUFwVersion().c_str());
|
||||
WSContentSeparatorIFat();
|
||||
#endif //CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||
bool show_hr = false;
|
||||
if ((WiFi.getMode() >= WIFI_AP) && (static_cast<uint32_t>(WiFi.softAPIP()) != 0)) {
|
||||
WSContentSend_P(PSTR("}1" D_MAC_ADDRESS "}2%s"), WiFi.softAPmacAddress().c_str());
|
||||
|
Loading…
x
Reference in New Issue
Block a user