SubGHz: Rework GPS as plugin, fix VGM (#5)

- Streamlined atomic init and deinit
- Load from plugin into RAM dynamically
- Don't attempt load if VGM / Expansion is connected
- Deduplicated some code, cleaned up some other bits
This commit is contained in:
Willy-JL
2024-03-30 03:38:59 +00:00
parent dcb5c50351
commit ef2c955995
15 changed files with 309 additions and 369 deletions

View File

@@ -251,10 +251,8 @@ SubGhz* subghz_alloc(bool alloc_for_tx_only) {
//Init Error_str
subghz->error_str = furi_string_alloc();
subghz->gps = subghz_gps_init();
if(subghz->last_settings->gps_baudrate != 0) {
subghz_gps_set_baudrate(subghz->gps, subghz->last_settings->gps_baudrate);
subghz_gps_start(subghz->gps);
subghz->gps = subghz_gps_plugin_init(subghz->last_settings->gps_baudrate);
}
return subghz;
@@ -352,10 +350,9 @@ void subghz_free(SubGhz* subghz, bool alloc_for_tx_only) {
furi_string_free(subghz->file_path_tmp);
// GPS
if(subghz->last_settings->gps_baudrate != 0) {
subghz_gps_stop(subghz->gps);
if(subghz->gps) {
subghz_gps_plugin_deinit(subghz->gps);
}
subghz_gps_deinit(subghz->gps);
subghz_last_settings_free(subghz->last_settings);