Hi,
Is there an "official" way to Init my private metrics without setting a value and having them marked modified?
The problem I am trying to solve is that if I do this, for instance:
> mt_i3_range_ecoproplus = MyMetrics.InitInt ("xi3.v.b.range.ecoproplus", SM_STALE_HIGH, 0, Kilometers);
Then "0" is officially published as the range. This is unlikely and messes up my charts. I'd rather not publish a value until I get one from the car.
I see that the standard metrics are just created with:
> ms_v_bat_range_full = new OvmsMetricFloat(MS_V_BAT_RANGE_FULL, SM_STALE_HIGH, Kilometers);
where V_BAT_RANGE_FULL is "v.b.range.full"
They have no value until they are explicitly set.
So would it be acceptable to rather create my private metrics like that?
I guess then it falls on me to check if the metric already exists - which is done as part of InitFloat.
So I guess I'd write:
> mt_i3_range_ecoproplus = (OvmsMetricInt*)MyMetrics.Find("xi3.v.b.range.ecoproplus");
> if (mt_i3_range_ecoproplus==NULL) mt_i3_range_ecoproplus = new OvmsMetricInt("xi3.v.b.range.ecoproplus", SM_STALE_HIGH, Kilometers, 0);
Is this a reasonable approach or am I going about this the wrong way?