Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specific directory for screens and logs #971

Merged
merged 2 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion firmware/application/apps/acars_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ ACARSAppView::ACARSAppView(NavigationView& nav) {
logging = v;
};

std::string folder = "LOGS";
make_new_directory(folder);
logger = std::make_unique<ACARSLogger>();
if (logger)
logger->append("acars.txt");
logger->append("LOGS/ACARS.TXT");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make more sense to have the /LOGS/ as a constant so you can reference that everywhere instead of hard coding it. Also what's the reason for capitalising everything?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.
Capitalized: it's upper case everywhere and it was not consistent for these files. So I changed to all upper.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I'm happy with that

}

ACARSAppView::~ACARSAppView() {
Expand Down
4 changes: 3 additions & 1 deletion firmware/application/apps/ais_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,11 @@ AISAppView::AISAppView(NavigationView& nav) : nav_ { nav } {
this->on_show_list();
};

std::string folder = "LOGS";
make_new_directory(folder);
logger = std::make_unique<AISLogger>();
if( logger ) {
logger->append(u"ais.txt");
logger->append(u"LOGS/AIS.TXT");
}
}

Expand Down
4 changes: 3 additions & 1 deletion firmware/application/apps/ert_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ ERTAppView::ERTAppView(NavigationView&) {
static_cast<int8_t>(receiver_model.vga()),
}); */

std::string folder = "LOGS";
make_new_directory(folder);
logger = std::make_unique<ERTLogger>();
if( logger ) {
logger->append(u"ert.txt");
logger->append(u"LOGS/ERT.TXT");
}
}

Expand Down
4 changes: 3 additions & 1 deletion firmware/application/apps/pocsag_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) {
ignore_address /= 10;
}

std::string folder = "LOGS";
make_new_directory(folder);
logger = std::make_unique<POCSAGLogger>();
if (logger)
logger->append("pocsag.txt");
logger->append("LOGS/POCSAG.TXT");

audio::output::start();
audio::output::unmute();
Expand Down
4 changes: 3 additions & 1 deletion firmware/application/apps/tpms_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ TPMSAppView::TPMSAppView(NavigationView&) {

options_temperature.set_selected_index(0, true);

std::string folder = "LOGS";
make_new_directory(folder);
logger = std::make_unique<TPMSLogger>();
if( logger ) {
logger->append(u"tpms.txt");
logger->append(u"LOGS/TMPS.TXT");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be TPMS, not TMPS

}
}

Expand Down
8 changes: 6 additions & 2 deletions firmware/application/apps/ui_adsb_rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ ADSBRxAircraftDetailsView::ADSBRxAircraftDetailsView(

std::unique_ptr<ADSBLogger> logger { };

logger = std::make_unique<ADSBLogger>();
std::string folder = "LOGS";
make_new_directory(folder);
if (logger)
logger->append(u"LOGS/ADSB.TXT");

icao_code = to_string_hex(entry_copy.ICAO_address, 6);
text_icao_address.set(to_string_hex(entry_copy.ICAO_address, 6));

Expand Down Expand Up @@ -351,7 +357,6 @@ void ADSBRxView::sort_entries_by_state()
}

void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
logger = std::make_unique<ADSBLogger>();
rtc::RTC datetime;
std::string callsign;
std::string str_info;
Expand Down Expand Up @@ -432,7 +437,6 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
} // frame.get_DF() == DF_ADSB

if (logger) {
logger->append(u"adsb.txt");
// will log each frame in format:
// 20171103100227 8DADBEEFDEADBEEFDEADBEEFDEADBEEF ICAO:nnnnnn callsign Alt:nnnnnn Latnnn.nn Lonnnn.nn
logger->log_str(logentry);
Expand Down
4 changes: 3 additions & 1 deletion firmware/application/apps/ui_afsk_rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ AFSKRxView::AFSKRxView(NavigationView& nav) {
nav.push<ModemSetupView>();
};

std::string folder = "LOGS";
make_new_directory(folder);
logger = std::make_unique<AFSKLogger>();
if (logger)
logger->append("AFSK_LOG.TXT");
logger->append("LOGS/AFSK.TXT");

// Auto-configure modem for LCR RX (will be removed later)
baseband::set_afsk(persistent_memory::modem_baudrate(), 8, 0, false);
Expand Down
4 changes: 3 additions & 1 deletion firmware/application/apps/ui_aprs_rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@ APRSRxView::APRSRxView(NavigationView& nav, Rect parent_rect) : View(parent_rect

options_region.set_selected_index(0, true);

std::string folder = "LOGS";
make_new_directory(folder);
logger = std::make_unique<APRSLogger>();
if (logger)
logger->append("APRS_RX_LOG.TXT");
logger->append("LOGS/APRS.TXT");

baseband::set_aprs(1200);

Expand Down
5 changes: 3 additions & 2 deletions firmware/application/apps/ui_sonde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ SondeView::SondeView(NavigationView& nav) {
999); //set a dummy heading out of range to draw a cross...probably not ideal?
};

std::string folder = "LOGS";
make_new_directory(folder);
logger = std::make_unique<SondeLogger>();
if (logger)
logger->append(u"sonde.txt");
logger->append(u"LOGS/SONDE.TXT");

// initialize audio:

field_volume.set_value((receiver_model.headphone_volume() - audio::headphone::volume_range().max).decibel() + 99);

field_volume.on_change = [this](int32_t v) {
Expand Down