[Ovmsdev] chatty v2 server comms

Tom Parker tom at carrott.org
Sun Dec 17 18:00:50 HKT 2017


On 10/12/17 00:31, Michael Balzer wrote:

> I fixed a minor bug in the v2 server code that caused much more data updates to be sent than necessary, can you please check if your data usage drops with that fix?
>
> https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/commit/ca6f4200d6f40ab2e11e5cb6f2b7ec9d1ab33097

I don't think changing from boolean to bitwise "or" would make a 
difference? I'm seeing a lot of messages, multiple per second, see below.

I think the problems are in 
components/ovms_server_v2/src/ovms_server_v2.cpp. In 
OvmsServerV2::ServerTask, the m_now_stat and similar logic will always 
be true in a real car. At a minimum we have 4 significant figures on the 
12v measurement, and the park timer will count up every second.

I changed the logic to only check once per minute and it's a lot less 
chatty, but this is probably not the right solution:

iff --git 
a/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp 
b/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp
index 32b463e..271b7ca 100644
--- a/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp
+++ b/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp
@@ -262,7 +262,6 @@ void OvmsServerV2::ServerTask()
          TransmitMsgFirmware(lasttx==0);
          TransmitMsgCapabilities(lasttx==0);
          lasttx = now;
-        }

        if (m_now_stat) TransmitMsgStat();
        if (m_now_environment) TransmitMsgEnvironment();
@@ -276,6 +275,7 @@ void OvmsServerV2::ServerTask()
        if (m_pending_notify_error) TransmitNotifyError();
        if (m_pending_notify_alert) TransmitNotifyAlert();
        if (m_pending_notify_data) TransmitNotifyData();
+      }

        // Poll for new data
        if ((m_buffer->PollSocket(m_conn.Socket(),1000) < 0)||

I haven't been following the notifications discussion but it looks like 
we need to discriminate between the metrics that change all the time and 
the metrics that should cause an update.

The log below is from before making the change.

2017-12-16 20:14:59,6038,'#59 C rx msg S 
85,K,391,4,charging,standard,71,0,10,29,0,0,3,1,0,0,0,0,0.00,0,0,0,0,-1,0,0,0,0,0,0,0,-0.00,391.50,0'
2017-12-16 20:15:00,6042,'#59 C rx msg D 
92,0,5,0,0,27,0,290,0,1765,24,0,1,1,13.1593,0,0,0,0,0'
2017-12-16 20:15:00,6043,'#59 C rx msg S 
85,K,392,4,charging,standard,71,0,10,30,0,0,3,1,0,0,0,0,0.00,0,0,0,0,-1,0,0,0,0,0,0,0,-0.00,391.50,0'
2017-12-16 20:15:00,6044,'#59 C rx msg D 
92,0,5,0,0,27,0,300,0,1826,24,0,1,1,13.1593,0,0,0,0,0'
2017-12-16 20:15:00,6045,'#59 C rx msg S 
85,K,392,3,charging,standard,71,0,10,31,0,0,3,1,0,0,0,0,0.00,0,0,0,0,-1,0,0,0,0,0,0,0,-0.00,392.00,0'
2017-12-16 20:15:00,6046,'#59 C rx msg D 
92,0,5,0,0,27,0,310,0,1887,24,0,1,1,13.1923,0,0,0,0,0'
2017-12-16 20:17:26,6510,'#59 C rx msg S 
85,K,392,4,charging,standard,71,0,10,32,0,0,3,1,0,0,0,0,0.00,0,0,0,0,-1,0,0,0,0,0,0,0,-0.00,392.00,0'
2017-12-16 20:17:28,6513,'#59 C rx msg D 
92,0,5,0,0,27,0,320,0,1948,24,0,1,1,13.1484,0,0,0,0,0'
2017-12-16 20:17:28,6514,'#59 C rx msg S 
85,K,392,4,charging,standard,72,0,10,33,0,0,3,1,0,0,0,0,0.00,0,0,0,0,-1,0,0,0,0,0,0,0,-0.00,392.00,0'
2017-12-16 20:17:28,6515,'#59 C rx msg D 
92,0,5,0,0,27,0,330,0,2009,24,0,1,1,13.1538,0,0,0,0,0'
2017-12-16 20:17:28,6516,'#59 C rx msg F 3.0.0/factory/main build (idf 
v2.1-20-g88ab5d4) Dec 16 2017 10:05:30,,4,1,NL,VodafoneNZ Hologram'
2017-12-16 20:17:28,6517,'#59 C rx msg S 
85,K,392,4,charging,standard,72,0,10,34,0,0,3,1,0,0,0,0,0.00,0,0,0,0,-1,0,0,0,0,0,0,0,-0.00,392.00,0'
2017-12-16 20:17:28,6518,'#59 C rx msg D 
92,0,5,0,0,27,0,340,0,2070,24,0,1,1,13.0549,0,0,0,0,0'
2017-12-16 20:17:28,6519,'#59 C rx msg D 
92,0,5,0,0,27,0,340,0,2071,24,0,1,1,13.0934,0,0,0,0,0'
2017-12-16 20:17:28,6520,'#59 C rx msg D 
92,0,5,0,0,27,0,340,0,2072,23,0,1,1,13.0934,0,0,0,0,0'
2017-12-16 20:17:28,6521,'#59 C rx msg D 
92,0,5,0,0,27,0,340,0,2073,24,0,1,1,13.0934,0,0,0,0,0'
2017-12-16 20:17:28,6523,'#59 C rx msg D 
92,0,5,0,0,27,0,340,0,2077,23,0,1,1,13.0934,0,0,0,0,0'
2017-12-16 20:17:29,6524,'#59 C rx msg D 
92,0,5,0,0,27,0,340,0,2078,24,0,1,1,13.0934,0,0,0,0,0'
2017-12-16 20:17:31,6528,'#59 C rx msg D 
92,0,5,0,0,27,0,340,0,2080,23,0,1,1,13.0934,0,0,0,0,0'
2017-12-16 20:17:32,6531,'#59 C rx msg D 
92,0,5,0,0,27,0,340,0,2081,23,0,1,1,13.0385,0,0,0,0,0'
2017-12-16 20:17:33,6532,'#59 C rx msg D 
92,0,5,0,0,27,0,340,0,2082,24,0,1,1,13.0385,0,0,0,0,0'



More information about the OvmsDev mailing list