mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-06 08:45:01 -04:00
TPMS: Add gain controls.
This commit is contained in:
parent
a475daeeea
commit
a0e7fdf90b
2 changed files with 42 additions and 2 deletions
|
@ -23,6 +23,9 @@
|
||||||
|
|
||||||
#include "baseband_api.hpp"
|
#include "baseband_api.hpp"
|
||||||
|
|
||||||
|
#include "portapack.hpp"
|
||||||
|
using namespace portapack;
|
||||||
|
|
||||||
#include "string_format.hpp"
|
#include "string_format.hpp"
|
||||||
|
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
@ -162,15 +165,31 @@ void RecentEntriesView<TPMSRecentEntries>::draw(
|
||||||
|
|
||||||
TPMSAppView::TPMSAppView(NavigationView&) {
|
TPMSAppView::TPMSAppView(NavigationView&) {
|
||||||
add_children({ {
|
add_children({ {
|
||||||
|
&rssi,
|
||||||
|
&channel,
|
||||||
|
&field_lna,
|
||||||
|
&field_vga,
|
||||||
&recent_entries_view,
|
&recent_entries_view,
|
||||||
} });
|
} });
|
||||||
|
|
||||||
|
field_lna.set_value(receiver_model.lna());
|
||||||
|
field_lna.on_change = [this](int32_t v_db) {
|
||||||
|
receiver_model.set_lna(v_db);
|
||||||
|
};
|
||||||
|
|
||||||
|
field_vga.set_value(receiver_model.vga());
|
||||||
|
field_vga.on_change = [this](int32_t v_db) {
|
||||||
|
receiver_model.set_vga(v_db);
|
||||||
|
};
|
||||||
|
|
||||||
radio::enable({
|
radio::enable({
|
||||||
tuning_frequency(),
|
tuning_frequency(),
|
||||||
sampling_rate,
|
sampling_rate,
|
||||||
baseband_bandwidth,
|
baseband_bandwidth,
|
||||||
rf::Direction::Receive,
|
rf::Direction::Receive,
|
||||||
false, 32, 32,
|
false,
|
||||||
|
static_cast<int8_t>(receiver_model.lna()),
|
||||||
|
static_cast<int8_t>(receiver_model.vga()),
|
||||||
1,
|
1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -197,7 +216,7 @@ void TPMSAppView::focus() {
|
||||||
|
|
||||||
void TPMSAppView::set_parent_rect(const Rect new_parent_rect) {
|
void TPMSAppView::set_parent_rect(const Rect new_parent_rect) {
|
||||||
View::set_parent_rect(new_parent_rect);
|
View::set_parent_rect(new_parent_rect);
|
||||||
recent_entries_view.set_parent_rect({ 0, 0, new_parent_rect.width(), new_parent_rect.height() });
|
recent_entries_view.set_parent_rect({ 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height });
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPMSAppView::on_packet(const tpms::Packet& packet) {
|
void TPMSAppView::on_packet(const tpms::Packet& packet) {
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "ui_widget.hpp"
|
#include "ui_widget.hpp"
|
||||||
#include "ui_navigation.hpp"
|
#include "ui_navigation.hpp"
|
||||||
|
#include "ui_receiver.hpp"
|
||||||
|
#include "ui_rssi.hpp"
|
||||||
|
#include "ui_channel.hpp"
|
||||||
|
|
||||||
#include "event_m0.hpp"
|
#include "event_m0.hpp"
|
||||||
|
|
||||||
|
@ -116,6 +119,24 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static constexpr ui::Dim header_height = 2 * 16;
|
||||||
|
|
||||||
|
RSSI rssi {
|
||||||
|
{ 21 * 8, 0, 6 * 8, 4 },
|
||||||
|
};
|
||||||
|
|
||||||
|
Channel channel {
|
||||||
|
{ 21 * 8, 5, 6 * 8, 4 },
|
||||||
|
};
|
||||||
|
|
||||||
|
LNAGainField field_lna {
|
||||||
|
{ 15 * 8, 0 * 16 }
|
||||||
|
};
|
||||||
|
|
||||||
|
VGAGainField field_vga {
|
||||||
|
{ 18 * 8, 0 * 16 }
|
||||||
|
};
|
||||||
|
|
||||||
TPMSRecentEntries recent;
|
TPMSRecentEntries recent;
|
||||||
std::unique_ptr<TPMSLogger> logger;
|
std::unique_ptr<TPMSLogger> logger;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue