diff options
author | root <root@avtech.domain.avtechpulse.com> | 1970-01-01 10:02:44 +0900 |
---|---|---|
committer | root <root@avtech.domain.avtechpulse.com> | 1970-01-01 10:02:44 +0900 |
commit | 754daf480b463ed836dd3139a3dae67b6f91b059 (patch) | |
tree | e58dd36a491d5a3f132f9ae0ccc70f16963a0028 /flash.c | |
parent | b472c5195f7ed1aa42c8e641e651009a7c0f8879 (diff) |
set *rcl amplitudes to safe values if fixed amplitudes used
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)); } } |