mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-26 15:59:28 -05:00
refactoring
This commit is contained in:
parent
32f957cead
commit
0025ad2507
@ -149,15 +149,8 @@ TPMSAppView::TPMSAppView(NavigationView&) {
|
|||||||
&field_lna,
|
&field_lna,
|
||||||
&field_vga,
|
&field_vga,
|
||||||
&options_type,
|
&options_type,
|
||||||
// &recent_entries_view,
|
|
||||||
// &recent_entries_view_psi,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// remove_children({
|
|
||||||
// &recent_entries_view,
|
|
||||||
// // &recent_entries_view_psi,
|
|
||||||
// });
|
|
||||||
|
|
||||||
radio::enable({
|
radio::enable({
|
||||||
tuning_frequency(),
|
tuning_frequency(),
|
||||||
sampling_rate,
|
sampling_rate,
|
||||||
@ -173,19 +166,6 @@ TPMSAppView::TPMSAppView(NavigationView&) {
|
|||||||
};
|
};
|
||||||
options_band.set_by_value(target_frequency());
|
options_band.set_by_value(target_frequency());
|
||||||
|
|
||||||
options_type.on_change = [this](size_t, int32_t i) {
|
|
||||||
if (i == 0){
|
|
||||||
tpms::format::use_kpa = true;
|
|
||||||
remove_child(&recent_entries_view_psi);
|
|
||||||
add_child(&recent_entries_view);
|
|
||||||
}
|
|
||||||
if(i == 1){
|
|
||||||
tpms::format::use_kpa = false;
|
|
||||||
remove_child(&recent_entries_view);
|
|
||||||
add_child(&recent_entries_view_psi);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
options_type.set_selected_index(0, true);
|
options_type.set_selected_index(0, true);
|
||||||
|
|
||||||
logger = std::make_unique<TPMSLogger>();
|
logger = std::make_unique<TPMSLogger>();
|
||||||
@ -206,7 +186,21 @@ 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, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height });
|
|
||||||
|
options_type.on_change = [this](size_t, int32_t i) {
|
||||||
|
if (i == 0){
|
||||||
|
tpms::format::use_kpa = true;
|
||||||
|
remove_child(&recent_entries_view_psi);
|
||||||
|
add_child(&recent_entries_view_kpa);
|
||||||
|
}
|
||||||
|
if(i == 1){
|
||||||
|
tpms::format::use_kpa = false;
|
||||||
|
remove_child(&recent_entries_view_kpa);
|
||||||
|
add_child(&recent_entries_view_psi);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
recent_entries_view_kpa.set_parent_rect({ 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height });
|
||||||
recent_entries_view_psi.set_parent_rect({ 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height });
|
recent_entries_view_psi.set_parent_rect({ 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +216,7 @@ void TPMSAppView::on_packet(const tpms::Packet& packet) {
|
|||||||
entry.update(reading);
|
entry.update(reading);
|
||||||
|
|
||||||
if(tpms::format::use_kpa){
|
if(tpms::format::use_kpa){
|
||||||
recent_entries_view.set_dirty();
|
recent_entries_view_kpa.set_dirty();
|
||||||
} else {
|
} else {
|
||||||
recent_entries_view_psi.set_dirty();
|
recent_entries_view_psi.set_dirty();
|
||||||
}
|
}
|
||||||
@ -231,8 +225,8 @@ void TPMSAppView::on_packet(const tpms::Packet& packet) {
|
|||||||
|
|
||||||
void TPMSAppView::on_show_list() {
|
void TPMSAppView::on_show_list() {
|
||||||
if(tpms::format::use_kpa){
|
if(tpms::format::use_kpa){
|
||||||
recent_entries_view.hidden(false);
|
recent_entries_view_kpa.hidden(false);
|
||||||
recent_entries_view.focus();
|
recent_entries_view_kpa.focus();
|
||||||
} else {
|
} else {
|
||||||
recent_entries_view_psi.hidden(false);
|
recent_entries_view_psi.hidden(false);
|
||||||
recent_entries_view_psi.focus();
|
recent_entries_view_psi.focus();
|
||||||
|
@ -162,7 +162,7 @@ private:
|
|||||||
TPMSRecentEntries recent { };
|
TPMSRecentEntries recent { };
|
||||||
std::unique_ptr<TPMSLogger> logger { };
|
std::unique_ptr<TPMSLogger> logger { };
|
||||||
|
|
||||||
const RecentEntriesColumns columns { {
|
const RecentEntriesColumns columns_kpa { {
|
||||||
{ "Tp", 2 },
|
{ "Tp", 2 },
|
||||||
{ "ID", 8 },
|
{ "ID", 8 },
|
||||||
{ "kPa", 3 },
|
{ "kPa", 3 },
|
||||||
@ -170,7 +170,7 @@ private:
|
|||||||
{ "Cnt", 3 },
|
{ "Cnt", 3 },
|
||||||
{ "Fl", 2 },
|
{ "Fl", 2 },
|
||||||
} };
|
} };
|
||||||
TPMSRecentEntriesView recent_entries_view { columns, recent };
|
TPMSRecentEntriesView recent_entries_view_kpa { columns_kpa, recent };
|
||||||
|
|
||||||
const RecentEntriesColumns columns_psi { {
|
const RecentEntriesColumns columns_psi { {
|
||||||
{ "Tp", 2 },
|
{ "Tp", 2 },
|
||||||
|
Loading…
Reference in New Issue
Block a user