PTT updates

This commit is contained in:
Mashintime 2023-11-30 16:50:10 -05:00
parent ab43314619
commit b7b51ad469
3 changed files with 8 additions and 4 deletions

View file

@ -18,8 +18,8 @@ const state = useStateStore(pinia);
<button <button
class="btn btn-sm btn-secondary me-1" class="btn btn-sm btn-secondary me-1"
v-bind:class="{ v-bind:class="{
'btn-danger': state.ptt_state === 'True', 'btn-danger': state.ptt_state == true,
'btn-secondary': state.ptt_state === 'False', 'btn-secondary': state.ptt_state == false,
}" }"
id="ptt_state" id="ptt_state"
type="button" type="button"

View file

@ -14,7 +14,7 @@ export const useStateStore = defineStore("stateStore", () => {
var dbfs_level = ref(0); var dbfs_level = ref(0);
var radio_status = ref(false); var radio_status = ref(false);
var ptt_state = ref("False"); var ptt_state = ref(false);
var speed_level = ref(0); var speed_level = ref(0);
var fft = ref(); var fft = ref();

View file

@ -6,6 +6,7 @@ class EventManager:
def __init__(self, queues): def __init__(self, queues):
self.queues = queues self.queues = queues
self.log = structlog.get_logger('Event Manager') self.log = structlog.get_logger('Event Manager')
self.lastpttstate = False
def broadcast(self, data): def broadcast(self, data):
self.log.debug(f"Broadcasting event: {data}") self.log.debug(f"Broadcasting event: {data}")
@ -13,7 +14,10 @@ class EventManager:
q.put(data) q.put(data)
def send_ptt_change(self, on:bool = False): def send_ptt_change(self, on:bool = False):
self.broadcast({"ptt": str(on)}) if (on == self.lastpttstate):
return
self.lastpttstate= on
self.broadcast({"ptt": bool(on)})
def send_scatter_change(self, data): def send_scatter_change(self, data):
self.broadcast({"scatter": str(data)}) self.broadcast({"scatter": str(data)})