Michael, From the condition in the v_type->SetValue, the type is only set if NewVehicle(type) is not NULL. So the question is whether we should raise the signal or not? I guess that is debatable, and probably better not to (as otherwise it is being raised with type as the parameter, but the type is not actually being set as the vehicle type). Regards, Mark
On 26 Nov 2023, at 9:26 AM, Michael Geddes <frog@bunyip.wheelycreek.net> wrote:
This code is from OvmsVehicleFactor::SetVehicle
m_currentvehicle = NewVehicle(type); if (m_currentvehicle) { m_currentvehicle->m_ready = true; } m_currentvehicletype = std::string(type); StandardMetrics.ms_v_type->SetValue(m_currentvehicle ? type : ""); MyEvents.SignalEvent("vehicle.type.set", (void*)type, strlen(type)+1);
My question is about what happens when NewVehicle() returns NULL.
Should m_currecntvehicletype, v.type and the SignalEvent all be set as blank? Any particular reason why only the v.type is set as blank?
//.ichael _______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev