Steve, Am 17.01.21 um 15:04 schrieb Steve Davies:
Is there an "official" way to Init my private metrics without setting a value and having them marked modified?
…
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?
That's perfectly OK. The Init…() calls are convenience wrappers. If you always deregister all your custom metrics in your destructor, you can skip the Find(). Regards, Michael -- Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal Fon 02333 / 833 5735 * Handy 0176 / 206 989 26