Fix PR #557 issues and run fbt format

This commit is contained in:
MX
2023-07-25 04:37:34 +03:00
parent 8e20aa6780
commit 2446c5c02b
3 changed files with 24 additions and 20 deletions

View File

@@ -490,7 +490,7 @@ int32_t spectrum_analyzer_app(void* p) {
hstep = WIDE_STEP; hstep = WIDE_STEP;
break; break;
} }
switch(input.type) { switch(input.type) {
case InputTypeShort: case InputTypeShort:
switch(input.key) { switch(input.key) {
@@ -507,13 +507,19 @@ int32_t spectrum_analyzer_app(void* p) {
FURI_LOG_D("Spectrum", "center_freq: %lu", model->center_freq); FURI_LOG_D("Spectrum", "center_freq: %lu", model->center_freq);
spectrum_analyzer_calculate_frequencies(model); spectrum_analyzer_calculate_frequencies(model);
spectrum_analyzer_worker_set_frequencies( spectrum_analyzer_worker_set_frequencies(
spectrum_analyzer->worker, model->channel0_frequency, model->spacing, model->width); spectrum_analyzer->worker,
model->channel0_frequency,
model->spacing,
model->width);
break; break;
case InputKeyLeft: case InputKeyLeft:
model->center_freq -= hstep; model->center_freq -= hstep;
spectrum_analyzer_calculate_frequencies(model); spectrum_analyzer_calculate_frequencies(model);
spectrum_analyzer_worker_set_frequencies( spectrum_analyzer_worker_set_frequencies(
spectrum_analyzer->worker, model->channel0_frequency, model->spacing, model->width); spectrum_analyzer->worker,
model->channel0_frequency,
model->spacing,
model->width);
FURI_LOG_D("Spectrum", "center_freq: %lu", model->center_freq); FURI_LOG_D("Spectrum", "center_freq: %lu", model->center_freq);
break; break;
case InputKeyOk: { case InputKeyOk: {
@@ -546,7 +552,10 @@ int32_t spectrum_analyzer_app(void* p) {
model->mode_change = false; model->mode_change = false;
spectrum_analyzer_calculate_frequencies(model); spectrum_analyzer_calculate_frequencies(model);
spectrum_analyzer_worker_set_frequencies( spectrum_analyzer_worker_set_frequencies(
spectrum_analyzer->worker, model->channel0_frequency, model->spacing, model->width); spectrum_analyzer->worker,
model->channel0_frequency,
model->spacing,
model->width);
FURI_LOG_D("Spectrum", "Width: %u", model->width); FURI_LOG_D("Spectrum", "Width: %u", model->width);
break; break;
case InputKeyBack: case InputKeyBack:
@@ -577,8 +586,9 @@ int32_t spectrum_analyzer_app(void* p) {
model->modulation_change = false; model->modulation_change = false;
spectrum_analyzer_worker_set_modulation( spectrum_analyzer_worker_set_modulation(
spectrum_analyzer->worker, spectrum_analyzer->worker, spectrum_analyzer->model->modulation);
spectrum_analyzer->model->modulation); break;
default:
break; break;
} }
break; break;

View File

@@ -125,8 +125,7 @@ static int32_t spectrum_analyzer_worker_thread(void* context) {
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00 0x00};
};
// Narrow modulation // Narrow modulation
const uint8_t narrow_modulation[] = { const uint8_t narrow_modulation[] = {
@@ -186,8 +185,7 @@ static int32_t spectrum_analyzer_worker_thread(void* context) {
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00 0x00};
};
const uint8_t* modulations[] = {default_modulation, narrow_modulation}; const uint8_t* modulations[] = {default_modulation, narrow_modulation};
@@ -197,7 +195,9 @@ static int32_t spectrum_analyzer_worker_thread(void* context) {
// FURI_LOG_T("SpectrumWorker", "spectrum_analyzer_worker_thread: Worker Loop"); // FURI_LOG_T("SpectrumWorker", "spectrum_analyzer_worker_thread: Worker Loop");
subghz_devices_idle(instance->radio_device); subghz_devices_idle(instance->radio_device);
subghz_devices_load_preset( subghz_devices_load_preset(
instance->radio_device, FuriHalSubGhzPresetCustom, (uint8_t*)modulations[instance->modulation]); instance->radio_device,
FuriHalSubGhzPresetCustom,
(uint8_t*)modulations[instance->modulation]);
//subghz_devices_load_preset( //subghz_devices_load_preset(
// instance->radio_device, FuriHalSubGhzPresetCustom, (uint8_t*)default_modulation); // instance->radio_device, FuriHalSubGhzPresetCustom, (uint8_t*)default_modulation);
//furi_hal_subghz_load_custom_preset(modulations[instance->modulation]); //furi_hal_subghz_load_custom_preset(modulations[instance->modulation]);
@@ -316,15 +316,11 @@ void spectrum_analyzer_worker_set_frequencies(
instance->width = width; instance->width = width;
} }
void spectrum_analyzer_worker_set_modulation( void spectrum_analyzer_worker_set_modulation(SpectrumAnalyzerWorker* instance, uint8_t modulation) {
SpectrumAnalyzerWorker* instance,
uint8_t modulation) {
furi_assert(instance); furi_assert(instance);
FURI_LOG_D( FURI_LOG_D(
"SpectrumWorker", "SpectrumWorker", "spectrum_analyzer_worker_set_modulation - modulation = %u", modulation);
"spectrum_analyzer_worker_set_modulation - modulation = %u",
modulation);
instance->modulation = modulation; instance->modulation = modulation;
} }

View File

@@ -28,9 +28,7 @@ void spectrum_analyzer_worker_set_frequencies(
uint32_t spacing, uint32_t spacing,
uint8_t width); uint8_t width);
void spectrum_analyzer_worker_set_modulation( void spectrum_analyzer_worker_set_modulation(SpectrumAnalyzerWorker* instance, uint8_t modulation);
SpectrumAnalyzerWorker* instance,
uint8_t modulation);
void spectrum_analyzer_worker_start(SpectrumAnalyzerWorker* instance); void spectrum_analyzer_worker_start(SpectrumAnalyzerWorker* instance);