mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-14 20:52:12 -04:00
Extract baseband stats into separate widget
Also removed baseband saturation indication on red (TX) LED. A saturation indicator needs to live somewhere else, and be thought out a bit more...
This commit is contained in:
parent
7c9fc62f5e
commit
154b40d3c9
4 changed files with 56 additions and 38 deletions
|
@ -27,10 +27,6 @@
|
|||
#include "ui_debug.hpp"
|
||||
#include "ui_receiver.hpp"
|
||||
|
||||
#include "hackrf_hal.hpp"
|
||||
#include "hackrf_gpio.hpp"
|
||||
using namespace hackrf::one;
|
||||
|
||||
extern ReceiverModel receiver_model;
|
||||
|
||||
namespace ui {
|
||||
|
@ -42,36 +38,12 @@ SystemStatusView::SystemStatusView() {
|
|||
&portapack,
|
||||
//&text_app_fifo_n,
|
||||
//&text_baseband_fifo_n,
|
||||
&text_ticks,
|
||||
&rssi,
|
||||
&channel,
|
||||
&audio,
|
||||
} });
|
||||
}
|
||||
|
||||
void SystemStatusView::on_show() {
|
||||
context().message_map[Message::ID::BasebandStatistics] = [this](const Message* const p) {
|
||||
this->on_statistics_update(static_cast<const BasebandStatisticsMessage*>(p)->statistics);
|
||||
};
|
||||
}
|
||||
|
||||
void SystemStatusView::on_hide() {
|
||||
context().message_map[Message::ID::BasebandStatistics] = nullptr;
|
||||
}
|
||||
|
||||
static std::string ticks_to_percent_string(const uint32_t ticks) {
|
||||
const uint32_t percent_x100 = ticks / (base_m4_clk_f / 10000);
|
||||
return
|
||||
to_string_dec_uint(percent_x100 / 100, 3) + "." +
|
||||
to_string_dec_uint(percent_x100 % 100, 2, '0') + "%";
|
||||
}
|
||||
|
||||
void SystemStatusView::on_statistics_update(const BasebandStatistics& statistics) {
|
||||
led_tx.write(statistics.saturation);
|
||||
portapack.set(ticks_to_percent_string(statistics.baseband_ticks));
|
||||
text_ticks.set(ticks_to_percent_string(statistics.idle_ticks));
|
||||
}
|
||||
|
||||
/* Navigation ************************************************************/
|
||||
|
||||
NavigationView::NavigationView()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue