From 4eb2ac75588b2ce1f47c2b52ec3ed9ce1b674d22 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Thu, 21 Dec 2017 19:39:18 -0500 Subject: Minor robustness and UI improvements Changes include: - Change the 'SCAN' label color when scanning. This visually signals to the user that scanning is taking place, which is useful with the Kingfisher Si4689 radio where scanning jumps to a found station. - Update the frequency when scanning signals a station is found. This improves behavior when using the Kingfisher radio, where the frequency update from the binding can fall prey to a race with the scanning state change in the QML. - Explicitly prevent triggering another scan while one is in progress. This is more of a general robustness fix to prevent unnecessary calls to the binding. It does help avoid potential issues with the Kingfisher radio where we really cannot interrupt a scan at present. Change-Id: I08825c7f51d354a20b38f647e72e4535bca37bd9 Signed-off-by: Scott Murray --- app/api/Binding.qml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'app/api/Binding.qml') diff --git a/app/api/Binding.qml b/app/api/Binding.qml index 3b43510..7750452 100644 --- a/app/api/Binding.qml +++ b/app/api/Binding.qml @@ -106,6 +106,7 @@ WebSocket { } else if (event.event === "radio/station_found") { if(scanningState == activeState) { scanningState = stoppedState + frequency = event.data.value stationId = freq2str(event.data.value) root.stationFound() } @@ -177,13 +178,17 @@ WebSocket { } function scanUp() { - scanningState = activeState - sendSocketMessage("scan_start", { direction: "forward" }) + if(scanningState != activeState) { + scanningState = activeState + sendSocketMessage("scan_start", { direction: "forward" }) + } } function scanDown() { - scanningState = activeState - sendSocketMessage("scan_start", { direction: "backward" }) + if(scanningState != activeState) { + scanningState = activeState + sendSocketMessage("scan_start", { direction: "backward" }) + } } function updateFrequencyRange(band) { -- cgit 1.2.3-korg