stored trace now also saved to flash

tinySA-v0.2
erikkaashoek 6 years ago
parent 27b183ccb1
commit 10d77ee691

@ -166,6 +166,14 @@ caldata_save(int id)
dst++;
}
// Flash stored trace
count = sizeof(stored_t) / sizeof(uint16_t);
src = (uint16_t*)&stored_t[0];
while (count-- > 0) {
flash_program_half_word((uint32_t)dst, *src++);
dst++;
}
/* after saving data, make active configuration points to flash */
// active_props = (setting_t*)saveareas[id];
lastsaveid = id;
@ -187,7 +195,7 @@ caldata_recall(int id)
if (src->magic != CONFIG_MAGIC)
return -1;
if (checksum(src, sizeof *src - sizeof src->checksum) != src->checksum)
if (checksum(src, sizeof setting - sizeof src->checksum) != src->checksum)
return -1;
/* active configuration points to save data on flash memory */
@ -196,6 +204,9 @@ caldata_recall(int id)
/* duplicated saved data onto sram to be able to modify marker/trace */
memcpy(dst, src, sizeof(setting_t));
// Restore stored trace
memcpy(stored_t, &src[1], sizeof(stored_t));
update_frequencies();
set_scale(setting.scale);
set_reflevel(setting.reflevel);

@ -563,8 +563,8 @@ typedef struct setting
marker_t _markers[MARKERS_MAX];
int8_t _active_marker;
int8_t unit;
uint32_t checksum;
float offset;
uint32_t checksum;
}setting_t;
extern setting_t setting;

@ -484,7 +484,7 @@ void set_mode(int m)
void apply_settings(void)
{
if (setting.mode == M_HIGH)
PE4302_Write_Byte(40);
PE4302_Write_Byte(40); // Ensure defined input impedance of low port when using high input mode (power calibration)
else
PE4302_Write_Byte(setting.attenuate * 2);
#if 0

Loading…
Cancel
Save

Powered by TurnKey Linux.