Thanks for the input - I'll push you a PR probably Monday - tomorrow Valentine's day and let's not take a chance on "you love that computer more than me" ;-)
Steve
On Sat, 13 Feb 2021 at 20:41, Michael Balzer <dexter@expeedo.de> wrote:
Steve,
yes, that may be enough time to trigger an alert, as the modem also
will need a couple of seconds to get the first fix after a reboot.
If that happens on the highway, you may well reach the alert
threshold.
A better init option:
if (!StdMetrics.ms_v_env_on->AsBool())
StdMetrics.ms_v_env_on->SetValue(false);
That takes advantage of the new persistence of the flag.
(Persistence cannot currently detect "false" as a defined value on
boot, as that's the default bool value.)
Furthermore, you can test the flag to see if you should directly set
the poll state to your driving mode. Btw, the same applies to most
status flags now, so you can for example also detect if a charge
session was active before the reboot.
Regards,
Michael
Am 13.02.21 um 19:25 schrieb Steve
Davies:
On Sat, 13 Feb 2021 at 12:39, Michael Balzer <dexter@expeedo.de>
wrote:
I suggest all vehicle
developers check their v.e.on logic before we
change this.
Well the bmwi3 logic is like so:
1) v_env_on is initialised to false when the module is
initialised
2) When the OBD-2 bus goes dead for 3 seconds I turn off
my polling and set v_env_on to false
3) Otherwise, v_env_on is set to (pollerstate
== POLLSTATE_READY &&
StdMetrics.ms_v_env_gear->AsInt() != 0) - i.e. OBD alive, car is
responsive on the OBD, and its in gear. You can't put it
in gear unless its "ready". This was the best I could do
since I can't find an OBD2 that plainly distinguishes "on"
(viz accessory position) from "ready" (let's go).
If the module boots up and
the OBD2 is alive there will be a brief interval of v.e.on
being false and as soon as we see obd2 traffic and see the
car in gear (that is polled every 4 seconds when the car
is READY) then v.e.on will change to true.
I suppose that may be
enough time for this alarm to go off?