File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,21 @@ local function processMspReply(cmd,rx_buf)
112112 for i = 1 ,# (rx_buf ) do
113113 Page .values [i ] = rx_buf [i ]
114114 end
115+
116+ for i = 1 ,# (Page .fields ) do
117+ if (# (Page .values ) or 0 ) >= Page .minBytes then
118+ local f = Page .fields [i ]
119+ if f .vals then
120+ f .value = 0 ;
121+ for idx = 1 , # (f .vals ) do
122+ local raw_val = Page .values [f .vals [idx ]]
123+ raw_val = bit32.lshift (raw_val , (idx - 1 )* 8 )
124+ f .value = bit32.bor (f .value , raw_val )
125+ end
126+ f .value = f .value / (f .scale or 1 )
127+ end
128+ end
129+ end
115130 if Page .postLoad then
116131 Page .postLoad (Page )
117132 end
@@ -196,16 +211,6 @@ local function drawScreen()
196211 else
197212 spacing = 0
198213 end
199- if Page .values then
200- if (# (Page .values ) or 0 ) >= Page .minBytes then
201- if not f .value and f .vals then
202- for idx = 1 , # (f .vals ) do
203- f .value = bit32.bor ((f .value or 0 ), bit32.lshift (Page .values [f .vals [idx ]], (idx - 1 )* 8 ))
204- end
205- f .value = f .value / (f .scale or 1 )
206- end
207- end
208- end
209214 if f .value then
210215 if f .upd and Page .values then
211216 f .upd (Page )
You can’t perform that action at this time.
0 commit comments