Added MAX_DECAY average

tinySA
erikkaashoek 6 years ago
parent 4b5e4dffdf
commit f0f6004bac

@ -5,8 +5,8 @@
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
# USE_OPT = -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
# USE_OPT = -O2 -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
USE_OPT = -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
endif
# C specific options here (added to USE_OPT).

@ -121,7 +121,7 @@ void load_default_properties(void);
extern float perform(bool b, int i, int32_t f, int e);
enum {
AV_OFF, AV_MIN, AV_MAX, AV_2, AV_4, AV_8
AV_OFF, AV_MIN, AV_MAX_HOLD, AV_MAX_DECAY, AV_4, AV_16
};
enum {
M_LOW, M_HIGH, M_GENLOW, M_GENHIGH,

@ -511,6 +511,8 @@ int avoid_spur(int f)
static int modulation_counter = 0;
char age[POINTS_COUNT];
float perform(bool break_on_operation, int i, int32_t f, int tracking)
{
// long local_IF = (MODE_LOW(setting_mode)?frequency_IF + (int)(actual_rbw < 300.0?setting_spur * 1000 * actual_rbw :0):0);
@ -594,15 +596,26 @@ static bool sweep(bool break_on_operation)
RSSI = RSSI - stored_t[i] ;
}
// stored_t[i] = (SI4432_Read_Byte(0x69) & 0x0f) * 3.0 - 90.0; // Display the AGC value in thestored trace
if (scandirty || setting_average == AV_OFF)
if (scandirty || setting_average == AV_OFF) {
actual_t[i] = RSSI;
else {
age[i] = 0;
} else {
switch(setting_average) {
case AV_MIN: if (actual_t[i] > RSSI) actual_t[i] = RSSI; break;
case AV_MAX: if (actual_t[i] < RSSI) actual_t[i] = RSSI; break;
case AV_2: actual_t[i] = (actual_t[i] + RSSI) / 2.0; break;
case AV_4: actual_t[i] = (actual_t[i]*3 + RSSI) / 4.0; break;
case AV_8: actual_t[i] = (actual_t[i]*7 + RSSI) / 8.0; break;
case AV_MIN: if (actual_t[i] > RSSI) actual_t[i] = RSSI; break;
case AV_MAX_HOLD: if (actual_t[i] < RSSI) actual_t[i] = RSSI; break;
case AV_MAX_DECAY:
if (actual_t[i] < RSSI) {
actual_t[i] = RSSI;
age[i] = 0;
} else {
if (age[i] > 20)
actual_t[i] -= 0.5;
else
age[i] += 1;
}
break;
case AV_4: actual_t[i] = (actual_t[i] + RSSI) / 4.0; break;
case AV_16: actual_t[i] = (actual_t[i]*3 + RSSI) / 16.0; break;
}
}
if (frequencies[i] > 1000000) {

@ -593,12 +593,12 @@ const menuitem_t menu_highoutputmode[] = {
};
static const menuitem_t menu_average[] = {
{ MT_CALLBACK, 0, "OFF", menu_average_cb},
{ MT_CALLBACK, 0, "MIN", menu_average_cb},
{ MT_CALLBACK, 0, "MAX", menu_average_cb},
{ MT_CALLBACK, 0, " 2 ", menu_average_cb},
{ MT_CALLBACK, 0, " OFF", menu_average_cb},
{ MT_CALLBACK, 0, "\2 MIN\0 HOLD", menu_average_cb},
{ MT_CALLBACK, 0, "\2 MAX\0 HOLD", menu_average_cb},
{ MT_CALLBACK, 0, "\2 MAX\0 DECAY", menu_average_cb},
{ MT_CALLBACK, 0, " 4 ", menu_average_cb},
{ MT_CALLBACK, 0, " 8 ", menu_average_cb},
{ MT_CALLBACK, 0, " 16 ", menu_average_cb},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};

Loading…
Cancel
Save

Powered by TurnKey Linux.