Small updates

pull/34/head
erikkaashoek 3 years ago
parent 70c323690a
commit 391dca6a30

@ -21,7 +21,7 @@
#include "hal.h" #include "hal.h"
#include "nanovna.h" #include "nanovna.h"
#define ADC_FULL_SCALE 3000 #define ADC_FULL_SCALE 3300
#define F303_ADC_VREF_ALWAYS_ON #define F303_ADC_VREF_ALWAYS_ON
#define ADC_CHSELR_VREFINT ADC_CHANNEL_IN18 #define ADC_CHSELR_VREFINT ADC_CHANNEL_IN18

@ -154,7 +154,7 @@ static THD_FUNCTION(Thread1, arg)
b.mode = setting.mode; b.mode = setting.mode;
uint32_t *f = (uint32_t *)&b; uint32_t *f = (uint32_t *)&b;
uint32_t *t = &backup; uint32_t *t = &backup;
int i = 5; int i = USED_BACKUP_SIZE;
while (i--) while (i--)
*t++ = *f++; *t++ = *f++;
@ -2576,7 +2576,7 @@ int main(void)
#endif #endif
if(config_recall()) { if(config_recall()) {
uint32_t *f = &backup; // Clear backup when no valid config data uint32_t *f = &backup; // Clear backup when no valid config data
int i = 5; int i = USED_BACKUP_SIZE;
while (i--) while (i--)
*f++ = 0; *f++ = 0;
} }
@ -2632,10 +2632,10 @@ int main(void)
backup_t b; backup_t b;
uint32_t *f = &backup; uint32_t *f = &backup;
uint32_t *t = (uint32_t *)&b; uint32_t *t = (uint32_t *)&b;
int i = 5; int i = USED_BACKUP_SIZE;
while (i--) while (i--)
*t++ = *f++; *t++ = *f++;
#if 0 // Set mode not working reliably #ifdef TINYSA4 // Set mode not working reliably
set_mode(b.mode); set_mode(b.mode);
switch (b.mode) { switch (b.mode) {
case M_LOW: case M_LOW:

@ -1564,7 +1564,7 @@ extern const menuitem_t menu_mode[];
extern void menu_push_submenu(const menuitem_t *submenu); extern void menu_push_submenu(const menuitem_t *submenu);
typedef struct { typedef struct {
uint32_t frequency0, frequency1; freq_t frequency0, frequency1;
uint8_t attenuation; uint8_t attenuation;
uint8_t reflevel; uint8_t reflevel;
uint8_t RBW; uint8_t RBW;
@ -1574,7 +1574,17 @@ typedef struct {
#define backup (*(uint32_t *)0x40002850) // backup registers 5 * 32 bits #define backup (*(uint32_t *)0x40002850) // backup registers 5 * 32 bits
#ifdef TINYSA4
#define MAX_BACKUP_SIZE 16
#define USED_BACKUP_SIZE 5
#else
#define MAX_BACKUP_SIZE 5
#define USED_BACKUP_SIZE 3
#endif
#if USED_BACKUP_SIZE > MAX_BACKUP_SIZE
#error "backup_t too large"
#endif
/* /*
* misclinous * misclinous
*/ */

Loading…
Cancel
Save

Powered by TurnKey Linux.