diff options
author | Scott Murray <scott.murray@konsulko.com> | 2017-12-21 19:39:18 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2017-12-21 19:39:18 -0500 |
commit | 4eb2ac75588b2ce1f47c2b52ec3ed9ce1b674d22 (patch) | |
tree | bccf355549c8b0b07dcfc75435f362d88c2c9b69 /app | |
parent | 29410eb4d5fe7331379423aafca886e8098fd5d2 (diff) |
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 <scott.murray@konsulko.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/Radio.qml | 16 | ||||
-rw-r--r-- | app/api/Binding.qml | 13 |
2 files changed, 22 insertions, 7 deletions
diff --git a/app/Radio.qml b/app/Radio.qml index f812af1..7b7797a 100644 --- a/app/Radio.qml +++ b/app/Radio.qml @@ -30,7 +30,10 @@ ApplicationWindow { property string title onBandChanged: frequency = minimumFrequency - onStationFound: title = stationId + onStationFound: { + title = stationId + scanLabel.color = '#FFFFFF' + } onFrequencyChanged: { title = '' slider.value = frequency @@ -172,6 +175,7 @@ ApplicationWindow { Item { Layout.fillWidth: true } Label { + id: scanLabel //Layout.fillWidth: true text: 'SCAN' } @@ -183,7 +187,10 @@ ApplicationWindow { triggeredOnStart: true interval: 100 repeat: true - onTriggered: radio.scanDown() + onTriggered: { + radio.scanDown() + scanLabel.color = '#59FF7F' + } } } @@ -194,7 +201,10 @@ ApplicationWindow { triggeredOnStart: true interval: 100 repeat: true - onTriggered: radio.scanUp() + onTriggered: { + radio.scanUp() + scanLabel.color = '#59FF7F' + } } } 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) { |