@@ -111,6 +111,17 @@ def move_to(self, x, y):
111
111
# "batt": float,
112
112
# }
113
113
# }
114
+ #
115
+ # {
116
+ # "cmd": "backend_update_node_telemetry"
117
+ # "args": {
118
+ # "id": str,
119
+ # "temp": float,
120
+ # "batt": float,
121
+ # "heading": float,
122
+ # "source": TELEMETRY or POSITION
123
+ # }
124
+ # }
114
125
115
126
class EngDisplay :
116
127
def __init__ (self , src = None ):
@@ -229,6 +240,14 @@ def main_loop(self):
229
240
self .backend .update_node_temp (msg ['args' ]['id' ], msg ['args' ]['temp' ])
230
241
elif msg ['cmd' ] == "backend_update_node_batt" :
231
242
self .backend .update_node_batt (msg ['args' ]['id' ], msg ['args' ]['batt' ])
243
+ elif msg ['cmd' ] == "backend_update_node_telemetry" :
244
+ try :
245
+ self .backend .update_node_telemetry (msg ['args' ]['id' ], msg ['args' ]['temp' ],
246
+ msg ['args' ]['batt' ], msg ['args' ]['heading' ],
247
+ msg ['args' ]['source' ])
248
+ except KeyError :
249
+ self .backend .update_node_telemetry (msg ['args' ]['id' ], msg ['args' ]['temp' ],
250
+ msg ['args' ]['batt' ], msg ['args' ]['heading' ])
232
251
else :
233
252
print (f"Unknown command: { msg ['cmd' ]} " )
234
253
else :
@@ -373,10 +392,10 @@ def draw_circle(self, args):
373
392
self .create_circle (x , y , r , extra_tags = tags , fill = fill , width = width , outline = outline )
374
393
375
394
if text is not None :
376
- ypos = y - r - 20
395
+ ypos = y - r - 20
377
396
if ypos < 0 :
378
- ypos = y + r + 20
379
- self .create_text (x ,ypos ,text = text )
397
+ ypos = y + r + 20
398
+ self .create_text (x , ypos , text = text )
380
399
381
400
def connect_points (self , args ):
382
401
pos1 = self .get_val_from_args (args , "pos1" )
@@ -399,7 +418,8 @@ def connect_points(self, args):
399
418
pos2_scaled = (pos2 [0 ] * self .meas_to_map * self .universal_scale + self .canvas .x_pos ,
400
419
pos2 [1 ] * self .meas_to_map * self .universal_scale + self .canvas .y_pos )
401
420
402
- self ._connect_points (pos1_scaled , pos2_scaled , text = text , text_size = text_size , text_color = text_color , dashed = dashed , color = color )
421
+ self ._connect_points (pos1_scaled , pos2_scaled , text = text , text_size = text_size , text_color = text_color ,
422
+ dashed = dashed , color = color )
403
423
404
424
def create_circle (self , x , y , r , extra_tags = [], ** kwargs ):
405
425
(x , y ) = self .translate_canvas_pos_to_screen_pos (x , y )
@@ -409,11 +429,12 @@ def create_circle(self, x, y, r, extra_tags=[], **kwargs):
409
429
def create_text (self , x , y , text = "" , extra_tags = [], ** kwargs ):
410
430
(x , y ) = self .translate_canvas_pos_to_screen_pos (x , y )
411
431
tags = ["obj" ]
412
- self .canvas .create_text (x ,y , text = text ,
413
- fill = "white" , font = font .Font (family = 'Courier New' , size = 14 ),
414
- justify = tk .LEFT ,tags = (tags + extra_tags ))
432
+ self .canvas .create_text (x , y , text = text ,
433
+ fill = "white" , font = font .Font (family = 'Courier New' , size = 14 ),
434
+ justify = tk .LEFT , tags = (tags + extra_tags ))
415
435
416
- def _connect_points (self , node1_pos , node2_pos , text = None , text_size = None , text_color = None , dashed = True , color = "#3c4048" ):
436
+ def _connect_points (self , node1_pos , node2_pos , text = None , text_size = None , text_color = None , dashed = True ,
437
+ color = "#3c4048" ):
417
438
if node2_pos [0 ] is None or node2_pos [1 ] is None or node1_pos [0 ] is None or node1_pos [1 ] is None :
418
439
return
419
440
if text is not None :
0 commit comments