diff options
Diffstat (limited to 'flash.c')
-rw-r--r-- | flash.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -3,6 +3,7 @@ #include "i2c.h" #include "version.h" #include "flash.h" +#include "device-functions.h" #include <stdint.h> #include <stdio.h> #include <stdbool.h> @@ -958,6 +959,14 @@ void fixFlash(FlashStruct *mem) } int j; + float safe_val = 0.0; + gboolean uses_fixed_ampl; + + uses_fixed_ampl = (number_of_fixed_ampl_points(i) > 0); + if (uses_fixed_ampl) { + safe_val = rst_fixed_ampl_point (i); + } + for (j=0; j<max_stored_settings; j++) { if (mem->rcl_burst_time[i][j] < globals.Constraints.composite_min_burst_time[i]) { mem->rcl_burst_time[i][j]=globals.Constraints.composite_min_burst_time[i]; @@ -975,6 +984,12 @@ void fixFlash(FlashStruct *mem) mem->rcl_soft_current_limit[i][j]=mem->max_soft_current_limit[i]; ++fix_initial_constants; } + + if (uses_fixed_ampl && !fixed_ampl_ok(i,mem->rcl_amplitude[i][j])) { + mem->rcl_amplitude[i][j] = safe_val; + ++fix_initial_constants; + } + } // for AVM-6-B in particular @@ -998,6 +1013,9 @@ void fixFlash(FlashStruct *mem) eprom_loc = (char *) &(mem->rcl_soft_current_limit) - (char *) &(mem->flash_start); writeUserBlock(&globals.Flash, eprom_loc, sizeof(mem->rcl_soft_current_limit)); + + eprom_loc = (char *) &(mem->rcl_amplitude) - (char *) &(mem->flash_start); + writeUserBlock(&globals.Flash, eprom_loc, sizeof(mem->rcl_amplitude)); } } |