mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-02-18 13:44:14 -05:00
Add GPS icon, fix overwrite bug (#2072)
This commit is contained in:
parent
6d9d5ad1af
commit
d29172f41e
@ -75,6 +75,7 @@ RecordView::RecordView(
|
|||||||
&rect_background,
|
&rect_background,
|
||||||
//&button_pitch_rssi,
|
//&button_pitch_rssi,
|
||||||
&button_record,
|
&button_record,
|
||||||
|
&gps_icon,
|
||||||
&text_record_filename,
|
&text_record_filename,
|
||||||
&text_record_dropped,
|
&text_record_dropped,
|
||||||
&text_time_available,
|
&text_time_available,
|
||||||
@ -93,6 +94,7 @@ RecordView::RecordView(
|
|||||||
signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
|
signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
|
||||||
this->on_tick_second();
|
this->on_tick_second();
|
||||||
};
|
};
|
||||||
|
gps_icon.hidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordView::~RecordView() {
|
RecordView::~RecordView() {
|
||||||
@ -180,6 +182,13 @@ void RecordView::start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path base_path;
|
std::filesystem::path base_path;
|
||||||
|
|
||||||
|
auto tmp_path = filename_stem_pattern; // store it, to be able to modify without causing permanent change
|
||||||
|
// check for geo data, if present append filename with _GEO
|
||||||
|
if (latitude != 0 && longitude != 0 && latitude < 200 && longitude < 200) {
|
||||||
|
tmp_path.append_filename(u"_GEO");
|
||||||
|
}
|
||||||
|
|
||||||
if (filename_date_frequency) {
|
if (filename_date_frequency) {
|
||||||
rtc_time::now(datetime);
|
rtc_time::now(datetime);
|
||||||
|
|
||||||
@ -192,24 +201,19 @@ void RecordView::start() {
|
|||||||
to_string_dec_uint(datetime.minute()) +
|
to_string_dec_uint(datetime.minute()) +
|
||||||
to_string_dec_uint(datetime.second());
|
to_string_dec_uint(datetime.second());
|
||||||
|
|
||||||
base_path = filename_stem_pattern.string() + "_" + date_time + "_" +
|
base_path = tmp_path.string() + "_" + date_time + "_" +
|
||||||
trim(to_string_freq(receiver_model.target_frequency())) + "Hz";
|
trim(to_string_freq(receiver_model.target_frequency())) + "Hz";
|
||||||
base_path = folder / base_path;
|
base_path = folder / base_path;
|
||||||
} else if (filename_as_is) {
|
} else if (filename_as_is) {
|
||||||
base_path = filename_stem_pattern.string();
|
base_path = tmp_path.string();
|
||||||
base_path = folder / base_path;
|
base_path = folder / base_path;
|
||||||
} else
|
} else
|
||||||
base_path = next_filename_matching_pattern(folder / filename_stem_pattern);
|
base_path = next_filename_matching_pattern(folder / tmp_path);
|
||||||
|
|
||||||
if (base_path.empty()) {
|
if (base_path.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for geo data, if present append filename with _GEO
|
|
||||||
if (latitude != 0 && longitude != 0 && latitude < 200 && longitude < 200) {
|
|
||||||
base_path.append_filename(u"_GEO");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<stream::Writer> writer;
|
std::unique_ptr<stream::Writer> writer;
|
||||||
switch (file_type) {
|
switch (file_type) {
|
||||||
case FileType::WAV: {
|
case FileType::WAV: {
|
||||||
@ -348,6 +352,8 @@ void RecordView::trim_capture() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RecordView::on_gps(const GPSPosDataMessage* msg) {
|
void RecordView::on_gps(const GPSPosDataMessage* msg) {
|
||||||
|
if (msg->lat == 0 || msg->lat > 399) return; // not valid one
|
||||||
|
if (latitude == 0) gps_icon.hidden(false); // prev was 0, so not shown already
|
||||||
latitude = msg->lat;
|
latitude = msg->lat;
|
||||||
longitude = msg->lon;
|
longitude = msg->lon;
|
||||||
satinuse = msg->satinuse;
|
satinuse = msg->satinuse;
|
||||||
|
@ -144,6 +144,12 @@ class RecordView : public View {
|
|||||||
"",
|
"",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Image gps_icon{
|
||||||
|
{2 * 8 + 1, 0 * 16, 2 * 8, 1 * 16},
|
||||||
|
&bitmap_target,
|
||||||
|
Color::white(),
|
||||||
|
Color::black()};
|
||||||
|
|
||||||
std::unique_ptr<CaptureThread> capture_thread{};
|
std::unique_ptr<CaptureThread> capture_thread{};
|
||||||
|
|
||||||
MessageHandlerRegistration message_handler_capture_thread_error{
|
MessageHandlerRegistration message_handler_capture_thread_error{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user