diff --git a/gui/src/components/main_active_stats.vue b/gui/src/components/main_active_stats.vue index d402916d..c8eae324 100644 --- a/gui/src/components/main_active_stats.vue +++ b/gui/src/components/main_active_stats.vue @@ -243,9 +243,9 @@ export default { data-bs-trigger="hover" data-bs-html="true" v-bind:class="{ - 'btn-warning': state.getChannelBusySlotState(0) === true, + 'btn-warning': state.channel_busy_slot[0] === true, 'btn-outline-secondary': - state.getChannelBusySlotState(0) === false, + state.channel_busy_slot[0] === false, }" title="Channel busy state: not busy / busy " > @@ -260,9 +260,9 @@ export default { data-bs-trigger="hover" data-bs-html="true" v-bind:class="{ - 'btn-warning': state.getChannelBusySlotState(1) === true, + 'btn-warning': state.channel_busy_slot[1] === true, 'btn-outline-secondary': - state.getChannelBusySlotState(1) === false, + state.channel_busy_slot[1] === false, }" title="Channel busy state: not busy / busy " > @@ -277,9 +277,9 @@ export default { data-bs-trigger="hover" data-bs-html="true" v-bind:class="{ - 'btn-warning': state.getChannelBusySlotState(2) === true, + 'btn-warning': state.channel_busy_slot[2] === true, 'btn-outline-secondary': - state.getChannelBusySlotState(2) === false, + state.channel_busy_slot[2] === false, }" title="Channel busy state: not busy / busy " > @@ -294,9 +294,9 @@ export default { data-bs-trigger="hover" data-bs-html="true" v-bind:class="{ - 'btn-warning': state.getChannelBusySlotState(3) === true, + 'btn-warning': state.channel_busy_slot[3] === true, 'btn-outline-secondary': - state.getChannelBusySlotState(3) === false, + state.channel_busy_slot[3] === false, }" title="Channel busy state: not busy / busy " > @@ -311,9 +311,9 @@ export default { data-bs-trigger="hover" data-bs-html="true" v-bind:class="{ - 'btn-warning': state.getChannelBusySlotState(4) === true, + 'btn-warning': state.channel_busy_slot[4] === true, 'btn-outline-secondary': - state.getChannelBusySlotState(4) === false, + state.channel_busy_slot[4] === false, }" title="Channel busy state: not busy / busy " > diff --git a/gui/src/store/stateStore.js b/gui/src/store/stateStore.js index b001afd3..f472f539 100644 --- a/gui/src/store/stateStore.js +++ b/gui/src/store/stateStore.js @@ -19,7 +19,7 @@ export const useStateStore = defineStore("stateStore", () => { var speed_level = ref(0); var fft = ref(); var channel_busy = ref(false); - var channel_busy_slot = ref(); + var channel_busy_slot = ref([false,false,false,false,false]); var scatter = ref(); var s_meter_strength_percent = ref(0); var s_meter_strength_raw = ref(0); @@ -64,25 +64,6 @@ export const useStateStore = defineStore("stateStore", () => { var rx_buffer_length = ref(); - function getChannelBusySlotState(slot) { - const slot_state = channel_busy_slot.value; - - if (typeof slot_state !== "undefined") { - // Replace 'False' with 'false' to match JavaScript's boolean representation - const string = slot_state - .replace(/False/g, "false") - .replace(/True/g, "true"); - - // Parse the string to get an array - const arr = JSON.parse(string); - - return arr[slot]; - } else { - // Handle the undefined case - return false; - } - } - function updateTncState(state) { modem_connection.value = state; @@ -109,7 +90,6 @@ export const useStateStore = defineStore("stateStore", () => { fft, channel_busy, channel_busy_slot, - getChannelBusySlotState, scatter, ptt_state, s_meter_strength_percent, diff --git a/modem/modem.py b/modem/modem.py index 5b169ef6..e485b330 100644 --- a/modem/modem.py +++ b/modem/modem.py @@ -1399,6 +1399,7 @@ class RF: slot3 = [120, 176] slot4 = [176, 231] slot5 = [231, len(dfftlist)] + slotbusy = [False,False,False,False,False] # Set to true if we should increment delay count; else false to decrement addDelay=False @@ -1413,11 +1414,11 @@ class RF: # so we have a smoother state toggle if np.sum(slotdfft[slotdfft > avg + 15]) >= 200 and not self.states.isTransmitting(): addDelay=True - self.states.channel_busy_slot[slot] = True - else: - self.states.channel_busy_slot[slot] = False + slotbusy[slot]=True + #self.states.channel_busy_slot[slot] = True # increment slot slot += 1 + self.states.set_channel_slot_busy(slotbusy) if addDelay: # Limit delay counter to a maximum of 200. The higher this value, # the longer we will wait until releasing state diff --git a/modem/state_manager.py b/modem/state_manager.py index aa77db87..3d3916ec 100644 --- a/modem/state_manager.py +++ b/modem/state_manager.py @@ -51,9 +51,6 @@ class StateManager: # Set rig control status regardless or rig control method self.radio_status = False - - - def sendState (self): currentState = self.get_state_event(False) self.statequeue.put(currentState) @@ -70,7 +67,15 @@ class StateManager: if new_state != self.newstate: self.newstate = new_state self.sendStateUpdate() - + + def set_channel_slot_busy(self, array): + for i in range(0,len(array),1): + if not array[i] == self.channel_busy_slot[i]: + self.channel_busy_slot = array + self.newstate = self.get_state_event(True) + self.sendStateUpdate() + continue + def get_state_event(self, isChangedState): msgtype = "state-change" if (not isChangedState): @@ -85,6 +90,7 @@ class StateManager: "radio_status": self.radio_status, "radio_frequency": self.radio_frequency, "radio_mode": self.radio_mode, + "channel_busy_slot": self.channel_busy_slot, } # .wait() blocks until the event is set @@ -101,8 +107,6 @@ class StateManager: def waitForTransmission(self): self.transmitting_event.wait() - - def register_arq_instance_by_id(self, id, instance): self.arq_instance_table[id] = instance