[Ovmsdev] Fwd: [openvehicles/Open-Vehicle-Monitoring-System-3] 29e333: Issue #36: Add support for ota/tag in config

Mark Webb-Johnson mark at webb-johnson.net
Fri May 11 16:58:30 HKT 2018


Nice. I like it when problems are reported with the fix. Thanks.

Committed fix.

Regards, Mark.

> On 11 May 2018, at 4:34 PM, Robin O'Leary <ovmsdev at caederus.org> wrote:
> 
> On Mon, Apr 16, 2018 at 09:13:33AM +0800, Mark Webb-Johnson wrote:
>> A few changes to OTA this morning:
>> 
>> The ‘ota status’ command used to check available server version only if a WIFI network was up. It now does that if ANY network is up (including modem).
>> 
>> I’ve added a config instance ‘tag’ to parameter ‘ota’. This can be used to override the ota tag (default: main) at run-time.
> 
> Something unexpected happens if the server/version/tag doesn't exist:
> 
> OVMS# ota status
> Running partition: ota_1
> Boot partition:    ota_1
> Firmware:          3.1.004-193-g0d5cc93/ota_1/ro2 (build idf v3.1-dev-454-gdaef4b5c May 11 2018 07:58:30)
> Server Available:  <!DOCTYPE html> (is newer)
> 
> <head>
> <meta charset="utf-8" />
> <link rel="shortcut icon" href="http://api.openvehicles.com/sites/default/files/favicon_0.ico" type="image/vnd.microsoft.icon" />
> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
> <title>Page not found | Open Vehicles</title>
> 
> ... followed by a couple more pages of html, including:
> 
>  <div class="content">
>    The requested page "/firmware/ota/v3.1/ro2/ovms3.ver" could not be found.  </div>
> 
> Fair enough that it didn't find an update as I'm using my own unique
> CONFIG_OVMS_VERSION_TAG "ro2", but it shouldn't mistake the html error
> page as a valid result.
> 
> Suggested fix:
> 
> diff --git a/vehicle/OVMS.V3/components/ovms_ota/src/ovms_ota.cpp b/vehicle/OVMS.V3/components/ovms_ota/src/ovms_ota.cpp
> index 226f502..9ed0b6a 100644
> --- a/vehicle/OVMS.V3/components/ovms_ota/src/ovms_ota.cpp
> +++ b/vehicle/OVMS.V3/components/ovms_ota/src/ovms_ota.cpp
> @@ -586,7 +586,7 @@ void OvmsOTA::GetStatus(ota_info& info, bool check_update /*=true*/)
>       url.append("/ovms3.ver");
> 
>       OvmsHttpClient http(url);
> -      if (http.IsOpen() && http.BodyHasLine())
> +      if (http.IsOpen() && http.ResponseCode() == 200 && http.BodyHasLine())
>         {
>         info.version_server = http.BodyReadLine();
>         char rbuf[512];
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev



More information about the OvmsDev mailing list