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
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
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;
break;
}
switch(input.type) {
case InputTypeShort:
switch(input.key) {
@ -507,13 +507,19 @@ int32_t spectrum_analyzer_app(void* p) {
FURI_LOG_D("Spectrum", "center_freq: %lu", model->center_freq);
spectrum_analyzer_calculate_frequencies(model);
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;
case InputKeyLeft:
model->center_freq -= hstep;
spectrum_analyzer_calculate_frequencies(model);
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);
break;
case InputKeyOk: {
@ -546,7 +552,10 @@ int32_t spectrum_analyzer_app(void* p) {
model->mode_change = false;
spectrum_analyzer_calculate_frequencies(model);
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);
break;
case InputKeyBack:
@ -577,8 +586,9 @@ int32_t spectrum_analyzer_app(void* p) {
model->modulation_change = false;
spectrum_analyzer_worker_set_modulation(
spectrum_analyzer->worker,
spectrum_analyzer->model->modulation);
spectrum_analyzer->worker, spectrum_analyzer->model->modulation);
break;
default:
break;
}
break;

View file

@ -125,8 +125,7 @@ static int32_t spectrum_analyzer_worker_thread(void* context) {
0x00,
0x00,
0x00,
0x00
};
0x00};
// 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};
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");
subghz_devices_idle(instance->radio_device);
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(
// instance->radio_device, FuriHalSubGhzPresetCustom, (uint8_t*)default_modulation);
//furi_hal_subghz_load_custom_preset(modulations[instance->modulation]);
@ -316,15 +316,11 @@ void spectrum_analyzer_worker_set_frequencies(
instance->width = width;
}
void spectrum_analyzer_worker_set_modulation(
SpectrumAnalyzerWorker* instance,
uint8_t modulation) {
void spectrum_analyzer_worker_set_modulation(SpectrumAnalyzerWorker* instance, uint8_t modulation) {
furi_assert(instance);
FURI_LOG_D(
"SpectrumWorker",
"spectrum_analyzer_worker_set_modulation - modulation = %u",
modulation);
"SpectrumWorker", "spectrum_analyzer_worker_set_modulation - modulation = %u", modulation);
instance->modulation = modulation;
}

View file

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