Skip to content

Commit

Permalink
Fix PR #557 issues and run fbt format
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Jul 25, 2023
1 parent 8e20aa6 commit 2446c5c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
22 changes: 16 additions & 6 deletions applications/external/spectrum_analyzer/spectrum_analyzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ int32_t spectrum_analyzer_app(void* p) {
hstep = WIDE_STEP;
break;
}

switch(input.type) {
case InputTypeShort:
switch(input.key) {
Expand All @@ -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: {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 7 additions & 11 deletions applications/external/spectrum_analyzer/spectrum_analyzer_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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};

Expand All @@ -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]);
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2446c5c

Please sign in to comment.