mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-02-08 18:58:34 -05:00
Weather app tweaks (#1610)
* Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload
This commit is contained in:
parent
861f684d00
commit
7ceefb1b81
@ -36,7 +36,7 @@ void WeatherRecentEntryDetailView::update_data() {
|
|||||||
// set text elements
|
// set text elements
|
||||||
text_type.set(WeatherView::getWeatherSensorTypeName((FPROTO_WEATHER_SENSOR)entry_.sensorType));
|
text_type.set(WeatherView::getWeatherSensorTypeName((FPROTO_WEATHER_SENSOR)entry_.sensorType));
|
||||||
text_id.set("0x" + to_string_hex(entry_.id));
|
text_id.set("0x" + to_string_hex(entry_.id));
|
||||||
text_temp.set(to_string_decimal(entry_.temp, 2));
|
text_temp.set(weather_units_fahr ? to_string_decimal((entry_.temp * 9 / 5) + 32, 1) + STR_DEGREES_F : to_string_decimal(entry_.temp, 2) + STR_DEGREES_C);
|
||||||
text_hum.set(to_string_dec_uint(entry_.humidity) + "%");
|
text_hum.set(to_string_dec_uint(entry_.humidity) + "%");
|
||||||
text_ch.set(to_string_dec_uint(entry_.channel));
|
text_ch.set(to_string_dec_uint(entry_.channel));
|
||||||
text_batt.set(to_string_dec_uint(entry_.battery_low) + " " + ((entry_.battery_low == 0) ? "OK" : "LOW"));
|
text_batt.set(to_string_dec_uint(entry_.battery_low) + " " + ((entry_.battery_low == 0) ? "OK" : "LOW"));
|
||||||
@ -81,6 +81,7 @@ WeatherView::WeatherView(NavigationView& nav)
|
|||||||
&field_lna,
|
&field_lna,
|
||||||
&field_vga,
|
&field_vga,
|
||||||
&field_frequency,
|
&field_frequency,
|
||||||
|
&options_temperature,
|
||||||
&button_clear_list,
|
&button_clear_list,
|
||||||
&recent_entries_view});
|
&recent_entries_view});
|
||||||
|
|
||||||
@ -90,17 +91,19 @@ WeatherView::WeatherView(NavigationView& nav)
|
|||||||
recent.clear();
|
recent.clear();
|
||||||
recent_entries_view.set_dirty();
|
recent_entries_view.set_dirty();
|
||||||
};
|
};
|
||||||
field_frequency.set_value(433920000);
|
field_frequency.set_step(100000);
|
||||||
field_frequency.set_step(1000);
|
|
||||||
|
options_temperature.on_change = [this](size_t, int32_t i) {
|
||||||
|
weather_units_fahr = (bool)i;
|
||||||
|
recent_entries_view.set_dirty();
|
||||||
|
};
|
||||||
|
options_temperature.set_selected_index(weather_units_fahr, false);
|
||||||
|
|
||||||
const Rect content_rect{0, header_height, screen_width, screen_height - header_height};
|
const Rect content_rect{0, header_height, screen_width, screen_height - header_height};
|
||||||
recent_entries_view.set_parent_rect(content_rect);
|
recent_entries_view.set_parent_rect(content_rect);
|
||||||
recent_entries_view.on_select = [this](const WeatherRecentEntry& entry) {
|
recent_entries_view.on_select = [this](const WeatherRecentEntry& entry) {
|
||||||
nav_.push<WeatherRecentEntryDetailView>(entry);
|
nav_.push<WeatherRecentEntryDetailView>(entry);
|
||||||
};
|
};
|
||||||
receiver_model.set_target_frequency(433'920'000);
|
|
||||||
receiver_model.set_sampling_rate(2'000'000);
|
|
||||||
receiver_model.set_baseband_bandwidth(1'750'000);
|
|
||||||
receiver_model.set_modulation(ReceiverModel::Mode::AMAudio);
|
|
||||||
baseband::set_weather();
|
baseband::set_weather();
|
||||||
receiver_model.enable();
|
receiver_model.enable();
|
||||||
}
|
}
|
||||||
@ -190,7 +193,7 @@ void RecentEntriesTable<ui::WeatherRecentEntries>::draw(
|
|||||||
line = truncate(line, 13);
|
line = truncate(line, 13);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string temp = to_string_decimal(entry.temp, 2);
|
std::string temp = (weather_units_fahr ? to_string_decimal((entry.temp * 9 / 5) + 32, 1) : to_string_decimal(entry.temp, 2));
|
||||||
std::string humStr = to_string_dec_uint(entry.humidity) + "%";
|
std::string humStr = to_string_dec_uint(entry.humidity) + "%";
|
||||||
std::string chStr = to_string_dec_uint(entry.channel);
|
std::string chStr = to_string_dec_uint(entry.channel);
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ using namespace ui;
|
|||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
static bool weather_units_fahr{false};
|
||||||
|
|
||||||
struct WeatherRecentEntry {
|
struct WeatherRecentEntry {
|
||||||
using Key = uint64_t;
|
using Key = uint64_t;
|
||||||
static constexpr Key invalid_key = 0x0fffffff; // todo calc the invalid all
|
static constexpr Key invalid_key = 0x0fffffff; // todo calc the invalid all
|
||||||
@ -92,12 +94,22 @@ class WeatherView : public View {
|
|||||||
433'920'000 /* frequency */,
|
433'920'000 /* frequency */,
|
||||||
1'750'000 /* bandwidth */,
|
1'750'000 /* bandwidth */,
|
||||||
2'000'000 /* sampling rate */,
|
2'000'000 /* sampling rate */,
|
||||||
ReceiverModel::Mode::SpectrumAnalysis};
|
ReceiverModel::Mode::AMAudio};
|
||||||
app_settings::SettingsManager settings_{
|
app_settings::SettingsManager settings_{
|
||||||
"rx_weather", app_settings::Mode::RX};
|
"rx_weather",
|
||||||
|
app_settings::Mode::RX,
|
||||||
|
{
|
||||||
|
{"units_fahr"sv, &weather_units_fahr},
|
||||||
|
}};
|
||||||
|
|
||||||
WeatherRecentEntries recent{};
|
WeatherRecentEntries recent{};
|
||||||
|
|
||||||
|
OptionsField options_temperature{
|
||||||
|
{10 * 8, 0 * 16},
|
||||||
|
2,
|
||||||
|
{{STR_DEGREES_C, 0},
|
||||||
|
{STR_DEGREES_F, 1}}};
|
||||||
|
|
||||||
RFAmpField field_rf_amp{
|
RFAmpField field_rf_amp{
|
||||||
{13 * 8, 0 * 16}};
|
{13 * 8, 0 * 16}};
|
||||||
LNAGainField field_lna{
|
LNAGainField field_lna{
|
||||||
|
@ -566,7 +566,7 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) {
|
|||||||
{"Recon", Color::green(), &bitmap_icon_scanner, [&nav]() { nav.push<ReconView>(); }},
|
{"Recon", Color::green(), &bitmap_icon_scanner, [&nav]() { nav.push<ReconView>(); }},
|
||||||
{"Search", Color::yellow(), &bitmap_icon_search, [&nav]() { nav.push<SearchView>(); }},
|
{"Search", Color::yellow(), &bitmap_icon_search, [&nav]() { nav.push<SearchView>(); }},
|
||||||
{"TPMS Cars", Color::green(), &bitmap_icon_tpms, [&nav]() { nav.push<TPMSAppView>(); }},
|
{"TPMS Cars", Color::green(), &bitmap_icon_tpms, [&nav]() { nav.push<TPMSAppView>(); }},
|
||||||
{"Weather", Color::green(), &bitmap_icon_lge, [&nav]() { nav.push<WeatherView>(); }},
|
{"Weather", Color::yellow(), &bitmap_icon_lge, [&nav]() { nav.push<WeatherView>(); }},
|
||||||
// {"FSK RX", Color::yellow(), &bitmap_icon_remote, [&nav]() { nav.push<FskxRxMainView>(); }},
|
// {"FSK RX", Color::yellow(), &bitmap_icon_remote, [&nav]() { nav.push<FskxRxMainView>(); }},
|
||||||
// {"DMR", Color::dark_grey(), &bitmap_icon_dmr, [&nav](){ nav.push<NotImplementedView>(); }},
|
// {"DMR", Color::dark_grey(), &bitmap_icon_dmr, [&nav](){ nav.push<NotImplementedView>(); }},
|
||||||
// {"SIGFOX", Color::dark_grey(), &bitmap_icon_fox, [&nav](){ nav.push<NotImplementedView>(); }},
|
// {"SIGFOX", Color::dark_grey(), &bitmap_icon_fox, [&nav](){ nav.push<NotImplementedView>(); }},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user