mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-12-13 18:22:15 +00:00
Looking glass beep (#2036)
* first draft of looking beep * fixed beep squelch range in percent * took out steps * gui adjustements * uniformize calculation and beep squelch in db * uniformisation, fix 24/48 error
This commit is contained in:
@@ -35,6 +35,11 @@ using portapack::memory::map::backup_ram;
|
||||
|
||||
namespace ui {
|
||||
|
||||
// Function to map the value from one range to another
|
||||
int32_t LevelView::map(int32_t value, int32_t fromLow, int32_t fromHigh, int32_t toLow, int32_t toHigh) {
|
||||
return toLow + (value - fromLow) * (toHigh - toLow) / (fromHigh - fromLow);
|
||||
}
|
||||
|
||||
void LevelView::m4_manage_stat_update() {
|
||||
if (audio_mode) {
|
||||
if (radio_mode == WFM_MODULATION || radio_mode == SPEC_MODULATION) {
|
||||
@@ -192,7 +197,7 @@ void LevelView::on_statistics_update(const ChannelStatistics& statistics) {
|
||||
}
|
||||
|
||||
if (beep && statistics.max_db > beep_squelch) {
|
||||
baseband::request_audio_beep(((132 + statistics.max_db) * 2000) / 120, 24000, 250);
|
||||
baseband::request_audio_beep(map(statistics.max_db, -100, 20, 400, 2600), 24000, 150);
|
||||
}
|
||||
|
||||
// refresh sat
|
||||
|
||||
Reference in New Issue
Block a user