git version fix and spectrum analyzer mod

This commit is contained in:
Eng1n33r 2022-06-22 04:53:21 +03:00
parent 72a5d5c2c7
commit 265bc5b961
2 changed files with 39 additions and 4 deletions

View file

@ -18,6 +18,8 @@ typedef struct {
uint32_t channel0_frequency;
uint32_t spacing;
bool mode_change;
float max_rssi;
uint8_t max_rssi_dec;
uint8_t max_rssi_channel;
@ -87,7 +89,7 @@ void spectrum_analyzer_draw_scale(Canvas* canvas, const SpectrumAnalyzerModel* m
static void spectrum_analyzer_render_callback(Canvas* const canvas, void* ctx) {
SpectrumAnalyzer* spectrum_analyzer = ctx;
furi_check(osMutexAcquire(spectrum_analyzer->model_mutex, osWaitForever) == osOK);
//furi_check(osMutexAcquire(spectrum_analyzer->model_mutex, osWaitForever) == osOK);
SpectrumAnalyzerModel* model = spectrum_analyzer->model;
@ -103,6 +105,32 @@ static void spectrum_analyzer_render_callback(Canvas* const canvas, void* ctx) {
canvas_draw_line(canvas, column, FREQ_BOTTOM_Y, column, y);
}
if(model->mode_change) {
char temp_mode_str[12];
switch(model->width) {
case NARROW:
strncpy(temp_mode_str, "NARROW", 12);
break;
case ULTRANARROW:
strncpy(temp_mode_str, "ULTRANARROW", 12);
break;
case ULTRAWIDE:
strncpy(temp_mode_str, "ULTRAWIDE", 12);
break;
default:
strncpy(temp_mode_str, "WIDE", 12);
break;
}
// Current mode label
char tmp_str[21];
snprintf(
tmp_str,
21,
"Mode: %s",
temp_mode_str);
canvas_draw_str_aligned(canvas, 127, 4, AlignRight, AlignTop, tmp_str);
}
// Draw cross and label
if(model->max_rssi > PEAK_THRESHOLD) {
// Compress height to max of 64 values (255>>2)
@ -143,7 +171,7 @@ static void spectrum_analyzer_render_callback(Canvas* const canvas, void* ctx) {
canvas_draw_str_aligned(canvas, 127, 0, AlignRight, AlignTop, temp_str);
}
osMutexRelease(spectrum_analyzer->model_mutex);
//osMutexRelease(spectrum_analyzer->model_mutex);
// FURI_LOG_D("Spectrum", "model->vscroll %u", model->vscroll);
}
@ -452,6 +480,13 @@ int32_t spectrum_analyzer_app(void* p) {
break;
}
}
model->mode_change = true;
view_port_update(spectrum_analyzer->view_port);
furi_hal_delay_ms(1000);
model->mode_change = false;
spectrum_analyzer_calculate_frequencies(model);
spectrum_analyzer_worker_set_frequencies(
spectrum_analyzer->worker, model->channel0_frequency, model->spacing, model->width);

View file

@ -1,9 +1,9 @@
GIT_COMMIT := $(shell git rev-parse --short HEAD || echo 'unknown')
GIT_BRANCH := $(shell echo $${WORKFLOW_BRANCH_OR_TAG-$$(git rev-parse --abbrev-ref HEAD || echo 'unknown')})
GIT_BRANCH := dev-cfw
GIT_BRANCH_NUM := $(shell git rev-list --count HEAD || echo 'nan')
BUILD_DATE := $(shell date '+%d-%m-%Y' || echo 'unknown')
BUILD_TIME := $(shell date '+%H:%M:%S' || echo 'unknown')
VERSION := $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null || echo 'unknown')
VERSION := $(shell echo $${WORKFLOW_BRANCH_OR_TAG-$$(git rev-parse --abbrev-ref HEAD || echo 'unknown')})
GIT_DIRTY_BUILD := 0 # TODO: Return git diff check back
GIT_DIRTY_SUFFIX :=