[Ovmsdev] Reading config in OvmsVehicleXXXInit

Soko ovms at soko.cc
Sun Jul 26 00:25:06 HKT 2020

Hey guys,

I'd like to keep the sources for the T26A and OBD version for the VW 
e-up separated.

With my little understanding of the OVMS framework I've created one 
(abstract) class for the vehicle with the web-interface stuff.

Then two derived classes, one for OBD one for T26A.

Now I try to register those two different classes depending on the settings:

   int how_connected = MyConfig.GetParamValueInt("vwup", 
"how_connected", CONN_OBD);
   ESP_LOGI(TAG, "Registering Vehicle: VW e-Up (9000). 
how_connected=%d", how_connected);

   if (how_connected == CONN_T26A)
MyVehicleFactory.RegisterVehicle<VWeUpT26a>("VWUP", "VW e-Up");
MyVehicleFactory.RegisterVehicle<VWeUpObd>("VWUP", "VW e-Up");

I know already that this only gets called during reboot as the 
log-message doesn't show up when I change the vehicle. But it seems that 
MyConfig isn't really the correct/same instance (?) as I'm getting 
inside my classes. Because the web-interface shows 
how_connected=CONN_T26A, but here it is always CONN_OBD (default value).

How do I do this properly?

Or is it even a better idea to do two separate vehicles??



More information about the OvmsDev mailing list