mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 05:36:39 +00:00
Extend command HostedOta with option <version>
- Use like `HostedOta v2.0.17`
This commit is contained in:
parent
afba1c8b9c
commit
042fe21d9d
@ -1343,14 +1343,18 @@ void CmndOtaUrl(void)
|
|||||||
|
|
||||||
#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED
|
#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED
|
||||||
void CmdHostedOta() {
|
void CmdHostedOta() {
|
||||||
// If OtaUrl = "https://ota.tasmota.com/tasmota32/tasmota32p4.bin"
|
/*
|
||||||
// Then use "https://ota.tasmota.com/tasmota32/coprocessor/network_adapter_" CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET ".bin"
|
If OtaUrl = "https://ota.tasmota.com/tasmota32/tasmota32p4.bin"
|
||||||
// As an option allow user to enter URL like:
|
Then use "https://ota.tasmota.com/tasmota32/coprocessor/network_adapter_" CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET ".bin"
|
||||||
// HostedOta https://ota.tasmota.com/tasmota32/coprocessor/network_adapter_esp32c6.bin
|
As an option allow user to enter URL like:
|
||||||
// HostedOta https://ota.tasmota.com/tasmota32/coprocessor/v2.0.14/network_adapter_esp32c6.bin
|
HostedOta https://ota.tasmota.com/tasmota32/coprocessor/network_adapter_esp32c6.bin
|
||||||
|
HostedOta https://ota.tasmota.com/tasmota32/coprocessor/v2.0.14/network_adapter_esp32c6.bin
|
||||||
|
Or allow user to enter required version like:
|
||||||
|
HostedOta v2.0.17
|
||||||
|
*/
|
||||||
TasmotaGlobal.hosted_ota_url = (char*)calloc(200, sizeof(char));
|
TasmotaGlobal.hosted_ota_url = (char*)calloc(200, sizeof(char));
|
||||||
if (!TasmotaGlobal.hosted_ota_url) { return; } // Unable to allocate memory
|
if (!TasmotaGlobal.hosted_ota_url) { return; } // Unable to allocate memory
|
||||||
if (XdrvMailbox.data_len) {
|
if (XdrvMailbox.data_len > 15) {
|
||||||
strlcpy(TasmotaGlobal.hosted_ota_url, XdrvMailbox.data, 200);
|
strlcpy(TasmotaGlobal.hosted_ota_url, XdrvMailbox.data, 200);
|
||||||
} else {
|
} else {
|
||||||
// Replace https://ota.tasmota.com/tasmota32/tasmota32p4.bin with https://ota.tasmota.com/tasmota32/coprocessor/network_adapter_esp32c6.bin
|
// Replace https://ota.tasmota.com/tasmota32/tasmota32p4.bin with https://ota.tasmota.com/tasmota32/coprocessor/network_adapter_esp32c6.bin
|
||||||
@ -1359,7 +1363,12 @@ void CmdHostedOta() {
|
|||||||
char *bch = strrchr(TasmotaGlobal.hosted_ota_url, '/'); // Only consider filename after last backslash
|
char *bch = strrchr(TasmotaGlobal.hosted_ota_url, '/'); // Only consider filename after last backslash
|
||||||
if (bch == nullptr) { bch = TasmotaGlobal.hosted_ota_url; } // No path found so use filename only
|
if (bch == nullptr) { bch = TasmotaGlobal.hosted_ota_url; } // No path found so use filename only
|
||||||
*bch = '\0'; // full_ota_url = https://ota.tasmota.com/tasmota32
|
*bch = '\0'; // full_ota_url = https://ota.tasmota.com/tasmota32
|
||||||
snprintf_P(TasmotaGlobal.hosted_ota_url, 200, PSTR("%s/coprocessor/network_adapter_" CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET ".bin"), TasmotaGlobal.hosted_ota_url);
|
char version[16] = { 0 };
|
||||||
|
if (XdrvMailbox.data_len) {
|
||||||
|
snprintf_P(version, sizeof(version), PSTR("/%s"), XdrvMailbox.data);
|
||||||
|
}
|
||||||
|
snprintf_P(TasmotaGlobal.hosted_ota_url, 200, PSTR("%s/coprocessor%s/network_adapter_" CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET ".bin"),
|
||||||
|
TasmotaGlobal.hosted_ota_url, version);
|
||||||
}
|
}
|
||||||
TasmotaGlobal.hosted_ota_state_flag = 1;
|
TasmotaGlobal.hosted_ota_state_flag = 1;
|
||||||
Response_P(PSTR("{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}"),
|
Response_P(PSTR("{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}"),
|
||||||
|
@ -64,7 +64,10 @@ String GetHostedMCUFwVersion(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int OTAHostedMCU(const char* image_url) {
|
int OTAHostedMCU(const char* image_url) {
|
||||||
return esp_hosted_slave_ota(image_url);
|
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("HST: About to OTA update with %s"), image_url);
|
||||||
|
int result = esp_hosted_slave_ota(image_url);
|
||||||
|
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("HST: Done with result %d"), result);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED
|
#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED
|
Loading…
x
Reference in New Issue
Block a user