TPMS: Add gain controls.

This commit is contained in:
Jared Boone 2016-06-06 09:50:48 -07:00
parent a475daeeea
commit a0e7fdf90b
2 changed files with 42 additions and 2 deletions

View File

@ -23,6 +23,9 @@
#include "baseband_api.hpp"
#include "portapack.hpp"
using namespace portapack;
#include "string_format.hpp"
#include "utility.hpp"
@ -162,15 +165,31 @@ void RecentEntriesView<TPMSRecentEntries>::draw(
TPMSAppView::TPMSAppView(NavigationView&) {
add_children({ {
&rssi,
&channel,
&field_lna,
&field_vga,
&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({
tuning_frequency(),
sampling_rate,
baseband_bandwidth,
rf::Direction::Receive,
false, 32, 32,
false,
static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga()),
1,
});
@ -197,7 +216,7 @@ void TPMSAppView::focus() {
void TPMSAppView::set_parent_rect(const 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) {

View File

@ -24,6 +24,9 @@
#include "ui_widget.hpp"
#include "ui_navigation.hpp"
#include "ui_receiver.hpp"
#include "ui_rssi.hpp"
#include "ui_channel.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;
std::unique_ptr<TPMSLogger> logger;