[Ovmsdev] Gas vs. battery metric?

Craig Leres leres at xse.com
Sat Jun 13 07:09:24 HKT 2020

I'd like to add a boolean metric for gas vehicles as a prelude to the
phone apps having this info. Would this be ok?

    #define MS_V_MOT_GAS "v.m.gas"

    ms_v_mot_gas = new OvmsMetricBool(MS_V_MOT_GAS);

The default to false. The other way would be via OvmsMetricInt and an
enum (or defines):

    typedef enum : uint8_t
      Battery = 0,
      Gasoline = 1,
    } metric_vehicle_t;

    #define MS_V_MOT_TYPE "v.m.type"

    ms_v_mot_type = new OvmsMetricInt(MS_V_MOT_TYPE);

which would allow for more than two types.


More information about the OvmsDev mailing list