diff --git a/nanovna.h b/nanovna.h index 85e05bc..58a6a6b 100644 --- a/nanovna.h +++ b/nanovna.h @@ -33,14 +33,18 @@ #define POINTS_COUNT 290 #define MARKER_COUNT 4 -#define TRACE_COUNT 3 +#define TRACES_MAX 3 +#define TRACE_AGE 3 #define TRACE_ACTUAL 2 #define TRACE_STORED 1 #define TRACE_TEMP 0 +// #define age_t measured[TRACE_AGE] #define stored_t measured[TRACE_STORED] #define actual_t measured[TRACE_ACTUAL] #define temp_t measured[TRACE_TEMP] -typedef float measurement_t[3][POINTS_COUNT]; + + +typedef float measurement_t[TRACES_MAX][POINTS_COUNT]; extern measurement_t measured; #endif @@ -243,8 +247,6 @@ extern const uint16_t numfont16x22[]; #define S_OHM "\036" // trace -#define TRACES_MAX 3 - #define MAX_TRACE_TYPE 12 enum trace_type { TRC_LOGMAG=0, TRC_PHASE, TRC_DELAY, TRC_SMITH, TRC_POLAR, TRC_LINEAR, TRC_SWR, TRC_REAL, TRC_IMAG, TRC_R, TRC_X, TRC_OFF @@ -418,7 +420,7 @@ void show_logo(void); * flash.c */ -#if 0 +#if 1 #define SAVEAREA_MAX 5 // Begin addr 0x08018000 #define SAVE_CONFIG_AREA_SIZE 0x00008000 diff --git a/si4432.c b/si4432.c index f4115a6..96a45a5 100644 --- a/si4432.c +++ b/si4432.c @@ -132,7 +132,6 @@ void SI4432_Reset(void) { int count = 0; // always perform a system reset (don't send 0x87) -again: SI4432_Write_Byte( 0x07, 0x80); chThdSleepMilliseconds(25); // wait for chiprdy bit @@ -147,7 +146,6 @@ void SI4432_Transmit(int d) SI4432_Write_Byte(0x6D, (byte) (0x1C+d)); if (( SI4432_Read_Byte ( 0x02 ) & 0x03 ) == 2) return; // Already in transmit mode -again: chThdSleepMilliseconds(20); SI4432_Write_Byte( 0x07, 0x0b); chThdSleepMilliseconds(20); @@ -161,7 +159,6 @@ void SI4432_Receive(void) int count = 0; if (( SI4432_Read_Byte ( 0x02 ) & 0x03 ) == 1) return; // Already in receive mode -again: SI4432_Write_Byte( 0x07, 0x07); chThdSleepMilliseconds(10); while (count++ < 100 && ( SI4432_Read_Byte ( 0x02 ) & 0x03 ) != 1) { @@ -188,7 +185,7 @@ static short RBW_choices[] = { // Each triple is: ndec, fils, WISH*10 float SI4432_SET_RBW(float w) { uint8_t dwn3=0; - uint32_t WISH = (uint32_t)(w * 10.0); + int32_t WISH = (uint32_t)(w * 10.0); uint8_t ndec, fils, i; if (WISH > 6207) WISH=6207; // Final value in RBW_choices[] if (WISH > 1379) dwn3 = 1 ; @@ -232,6 +229,7 @@ int actualStepDelay = 1500; float SI4432_RSSI(uint32_t i, int s) { int RSSI_RAW; + (void) i; // SEE DATASHEET PAGE 61 #ifdef USE_SI4463 if (SI4432_Sel == 2) { @@ -252,7 +250,7 @@ float SI4432_RSSI(uint32_t i, int s) } -void SI4432_Sub_Init() +void SI4432_Sub_Init(void) { SI4432_Reset(); SI4432_Write_Byte(0x05, 0x0);