Sungwoo Kim
/
HydraulicControlBoard_PostLIGHT_210420
LIGHT2
Diff: function_utilities/function_utilities.cpp
- Revision:
- 15:bd0d12728506
- Parent:
- 14:8e7590227d22
- Child:
- 16:903b5a4433b4
diff -r 8e7590227d22 -r bd0d12728506 function_utilities/function_utilities.cpp --- a/function_utilities/function_utilities.cpp Thu Aug 29 07:38:00 2019 +0000 +++ b/function_utilities/function_utilities.cpp Fri Aug 30 02:26:11 2019 +0000 @@ -320,80 +320,296 @@ ******************************************************************************/ void ROM_INIT_DATA(void) { - static int16_t temp_check_num = LATEST_VERSION; - spi_eeprom_ready(); - //if (spi_eeprom_read(RID_IS_FIRST) != temp_check_num) { - spi_eeprom_ready(); - spi_eeprom_write(RID_IS_FIRST, temp_check_num); - ROM_RESET_DATA(); - //} +// static int16_t temp_check_num = LATEST_VERSION; +// spi_eeprom_ready(); +// if (spi_eeprom_read(RID_IS_FIRST) != temp_check_num) { +// spi_eeprom_ready(); +// spi_eeprom_write(RID_IS_FIRST, temp_check_num); +// ROM_RESET_DATA(); +// } ROM_CALL_DATA(); + ROM_RESET_DATA(); } void ROM_RESET_DATA(void) { + spi_eeprom_ready(); + spi_eeprom_write(RID_BNO, (int) BNO); + spi_eeprom_ready(); + BNO = spi_eeprom_read(RID_BNO); + BNO = 11; + + spi_eeprom_ready(); + spi_eeprom_write(RID_OPERATING_MODE, (int) OPERATING_MODE); + spi_eeprom_ready(); + OPERATING_MODE = spi_eeprom_read(RID_OPERATING_MODE); + + spi_eeprom_ready(); + spi_eeprom_write(RID_CAN_FREQ, (int) CAN_FREQ); + spi_eeprom_ready(); + CAN_FREQ = spi_eeprom_read(RID_CAN_FREQ); + + spi_eeprom_ready(); + spi_eeprom_write(RID_JOINT_ENC_DIR, (int) DIR_JOINT_ENC); + spi_eeprom_ready(); + DIR_JOINT_ENC = spi_eeprom_read(RID_JOINT_ENC_DIR); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_DIR, (int) DIR_VALVE); + spi_eeprom_ready(); + DIR_VALVE = spi_eeprom_read(RID_VALVE_DIR); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_ENC_DIR, (int) DIR_VALVE_ENC); + spi_eeprom_ready(); + DIR_VALVE_ENC = spi_eeprom_read(RID_VALVE_ENC_DIR); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VOLATGE_SUPPLY, (int) (SUPPLY_VOLTAGE * 10.0)); + spi_eeprom_ready(); + SUPPLY_VOLTAGE = (double) spi_eeprom_read(RID_VOLATGE_SUPPLY) / 10.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_VOLTAGE_VALVE, (int) (VALVE_VOLTAGE_LIMIT * 10.0)); + spi_eeprom_ready(); + VALVE_VOLTAGE_LIMIT = (double) spi_eeprom_read(RID_VOLTAGE_VALVE) / 10.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_P_GAIN_VALVE_POSITION, (int) P_GAIN_VALVE_POSITION); + spi_eeprom_ready(); + P_GAIN_VALVE_POSITION = spi_eeprom_read(RID_P_GAIN_VALVE_POSITION); + + spi_eeprom_ready(); + spi_eeprom_write(RID_I_GAIN_VALVE_POSITION, (int) I_GAIN_VALVE_POSITION); + spi_eeprom_ready(); + I_GAIN_VALVE_POSITION = spi_eeprom_read(RID_I_GAIN_VALVE_POSITION); + + spi_eeprom_ready(); + spi_eeprom_write(RID_D_GAIN_VALVE_POSITION, (int) D_GAIN_VALVE_POSITION); + spi_eeprom_ready(); + D_GAIN_VALVE_POSITION = spi_eeprom_read(RID_D_GAIN_VALVE_POSITION); + + spi_eeprom_ready(); + spi_eeprom_write(RID_P_GAIN_JOINT_POSITION, (int) P_GAIN_JOINT_POSITION); + spi_eeprom_ready(); + P_GAIN_JOINT_POSITION = spi_eeprom_read(RID_P_GAIN_JOINT_POSITION); + + spi_eeprom_ready(); + spi_eeprom_write(RID_I_GAIN_JOINT_POSITION, (int) I_GAIN_JOINT_POSITION); + spi_eeprom_ready(); + I_GAIN_JOINT_POSITION = spi_eeprom_read(RID_I_GAIN_JOINT_POSITION); + + spi_eeprom_ready(); + spi_eeprom_write(RID_D_GAIN_JOINT_POSITION, (int) D_GAIN_JOINT_POSITION); + spi_eeprom_ready(); + D_GAIN_JOINT_POSITION = spi_eeprom_read(RID_D_GAIN_JOINT_POSITION); + + spi_eeprom_ready(); + spi_eeprom_write(RID_P_GAIN_JOINT_TORQUE, (int) P_GAIN_JOINT_TORQUE); + spi_eeprom_ready(); + P_GAIN_JOINT_TORQUE = spi_eeprom_read(RID_P_GAIN_JOINT_TORQUE); + + spi_eeprom_ready(); + spi_eeprom_write(RID_I_GAIN_JOINT_TORQUE, (int) I_GAIN_JOINT_TORQUE); + spi_eeprom_ready(); + I_GAIN_JOINT_TORQUE = spi_eeprom_read(RID_I_GAIN_JOINT_TORQUE); + + spi_eeprom_ready(); + spi_eeprom_write(RID_D_GAIN_JOINT_TORQUE, (int) D_GAIN_JOINT_TORQUE); + spi_eeprom_ready(); + D_GAIN_JOINT_TORQUE = spi_eeprom_read(RID_D_GAIN_JOINT_TORQUE); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_DEADZONE_PLUS, (int) (VALVE_DEADZONE_PLUS)); + spi_eeprom_ready(); + VALVE_DEADZONE_PLUS = spi_eeprom_read(RID_VALVE_DEADZONE_PLUS); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_DEADZONE_MINUS, (int) (VALVE_DEADZONE_MINUS)); + spi_eeprom_ready(); + VALVE_DEADZONE_MINUS = spi_eeprom_read(RID_VALVE_DEADZONE_MINUS); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VELOCITY_COMP_GAIN, (int) VELOCITY_COMP_GAIN); + spi_eeprom_ready(); + VELOCITY_COMP_GAIN = spi_eeprom_read(RID_VELOCITY_COMP_GAIN); + + spi_eeprom_ready(); + spi_eeprom_write(RID_COMPLIANCE_GAIN, (int) COMPLIANCE_GAIN); + spi_eeprom_ready(); + COMPLIANCE_GAIN = spi_eeprom_read(RID_COMPLIANCE_GAIN); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_CNETER, (int) VALVE_CENTER); + spi_eeprom_ready(); + VALVE_CENTER = spi_eeprom_read(RID_VALVE_CNETER); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_FF, (int) VALVE_FF); + spi_eeprom_ready(); + VALVE_FF = spi_eeprom_read(RID_VALVE_FF); + + spi_eeprom_ready(); + spi_eeprom_write(RID_BULK_MODULUS, (int) BULK_MODULUS); + spi_eeprom_ready(); + BULK_MODULUS = spi_eeprom_read(RID_BULK_MODULUS); + + spi_eeprom_ready(); + spi_eeprom_write(RID_CHAMBER_VOLUME_A, (int) CHAMBER_VOLUME_A); + spi_eeprom_ready(); + CHAMBER_VOLUME_A = spi_eeprom_read(RID_CHAMBER_VOLUME_A); + + spi_eeprom_ready(); + spi_eeprom_write(RID_CHAMBER_VOLUME_B, (int) CHAMBER_VOLUME_B); + spi_eeprom_ready(); + CHAMBER_VOLUME_B = spi_eeprom_read(RID_CHAMBER_VOLUME_B); + + spi_eeprom_ready(); + spi_eeprom_write(RID_PISTON_AREA_A, (int) PISTON_AREA_A); + spi_eeprom_ready(); + PISTON_AREA_A = spi_eeprom_read(RID_PISTON_AREA_A); + + spi_eeprom_ready(); + spi_eeprom_write(RID_PISTON_AREA_B, (int) PISTON_AREA_B); + spi_eeprom_ready(); + PISTON_AREA_B = spi_eeprom_read(RID_PISTON_AREA_B); + + spi_eeprom_ready(); + spi_eeprom_write(RID_PRES_SUPPLY, (int) PRES_SUPPLY); + spi_eeprom_ready(); + PRES_SUPPLY = spi_eeprom_read(RID_PRES_SUPPLY); + + spi_eeprom_ready(); + spi_eeprom_write(RID_PRES_RETURN, (int) PRES_RETURN); + spi_eeprom_ready(); + PRES_RETURN = spi_eeprom_read(RID_PRES_RETURN); + + spi_eeprom_ready(); + spi_eeprom_write(RID_ENC_LIMIT_MINUS, (int) ENC_LIMIT_MINUS); + spi_eeprom_ready(); + ENC_LIMIT_MINUS = spi_eeprom_read(RID_ENC_LIMIT_MINUS); + + spi_eeprom_ready(); + spi_eeprom_write(RID_ENC_LIMIT_PLUS, (int) ENC_LIMIT_PLUS); + spi_eeprom_ready(); + ENC_LIMIT_PLUS = spi_eeprom_read(RID_ENC_LIMIT_PLUS); + + spi_eeprom_ready(); + spi_eeprom_write(RID_STROKE, (int) STROKE); + spi_eeprom_ready(); + STROKE = spi_eeprom_read(RID_STROKE); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_LIMIT_MINUS, (int) VALVE_LIMIT_MINUS); + spi_eeprom_ready(); + VALVE_LIMIT_MINUS = spi_eeprom_read(RID_VALVE_LIMIT_MINUS); + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_LIMIT_PLUS, (int) VALVE_LIMIT_PLUS); + spi_eeprom_ready(); + VALVE_LIMIT_PLUS = spi_eeprom_read(RID_VALVE_LIMIT_PLUS); + + spi_eeprom_ready(); + spi_eeprom_write(RID_ENC_PULSE_PER_POSITION, (int) ENC_PULSE_PER_POSITION); + spi_eeprom_ready(); + ENC_PULSE_PER_POSITION = spi_eeprom_read(RID_ENC_PULSE_PER_POSITION); + + TORQUE_SENSOR_PULSE_PER_TORQUE = 4096.0 / 200.0; + spi_eeprom_ready(); + spi_eeprom_write(RID_TORQUE_SENSOR_PULSE_PER_TORQUE, (int) TORQUE_SENSOR_PULSE_PER_TORQUE); + spi_eeprom_ready(); + TORQUE_SENSOR_PULSE_PER_TORQUE = spi_eeprom_read(RID_TORQUE_SENSOR_PULSE_PER_TORQUE); + + PRES_SENSOR_A_PULSE_PER_BAR = 4096.0 / 200.0; + spi_eeprom_ready(); + spi_eeprom_write(RID_PRES_SENSOR_A_PULSE_PER_BAR, (int) (PRES_SENSOR_A_PULSE_PER_BAR * 100.0)); + spi_eeprom_ready(); + PRES_SENSOR_A_PULSE_PER_BAR = (double) spi_eeprom_read(RID_PRES_SENSOR_A_PULSE_PER_BAR) * 0.01; - spi_eeprom_write(RID_BNO, (int16_t) BNO); - spi_eeprom_write(RID_OPERATING_MODE, (int16_t) OPERATING_MODE); - spi_eeprom_write(RID_CAN_FREQ, (int16_t) CAN_FREQ); - spi_eeprom_write(RID_JOINT_ENC_DIR, (int16_t) DIR_JOINT_ENC); - spi_eeprom_write(RID_VALVE_DIR, (int16_t) DIR_VALVE); - spi_eeprom_write(RID_VALVE_ENC_DIR, (int16_t) DIR_VALVE_ENC); - spi_eeprom_write(RID_VOLATGE_SUPPLY, (int16_t) (SUPPLY_VOLTAGE * 10.)); - spi_eeprom_write(RID_VOLTAGE_VALVE, (int16_t) (VALVE_VOLTAGE_LIMIT * 10.)); - spi_eeprom_write(RID_P_GAIN_VALVE_POSITION, (int16_t) P_GAIN_VALVE_POSITION); - spi_eeprom_write(RID_I_GAIN_VALVE_POSITION, (int16_t) I_GAIN_VALVE_POSITION); - spi_eeprom_write(RID_D_GAIN_VALVE_POSITION, (int16_t) D_GAIN_VALVE_POSITION); - spi_eeprom_write(RID_P_GAIN_JOINT_POSITION, (int16_t) P_GAIN_JOINT_POSITION); - spi_eeprom_write(RID_I_GAIN_JOINT_POSITION, (int16_t) I_GAIN_JOINT_POSITION); - spi_eeprom_write(RID_D_GAIN_JOINT_POSITION, (int16_t) D_GAIN_JOINT_POSITION); - spi_eeprom_write(RID_P_GAIN_JOINT_TORQUE, (int16_t) P_GAIN_JOINT_TORQUE); - spi_eeprom_write(RID_I_GAIN_JOINT_TORQUE, (int16_t) I_GAIN_JOINT_TORQUE); - spi_eeprom_write(RID_D_GAIN_JOINT_TORQUE, (int16_t) D_GAIN_JOINT_TORQUE); - spi_eeprom_write(RID_VALVE_DEADZONE_PLUS, (int16_t) (VALVE_DEADZONE_PLUS)); - spi_eeprom_write(RID_VALVE_DEADZONE_MINUS, (int16_t) (VALVE_DEADZONE_MINUS)); - spi_eeprom_write(RID_VELOCITY_COMP_GAIN, (int16_t) VELOCITY_COMP_GAIN); - spi_eeprom_write(RID_COMPLIANCE_GAIN, (int16_t) COMPLIANCE_GAIN); - spi_eeprom_write(RID_VALVE_CNETER, (int16_t) VALVE_CENTER); - spi_eeprom_write(RID_VALVE_FF, (int16_t) VALVE_FF); - spi_eeprom_write(RID_BULK_MODULUS, (int16_t) BULK_MODULUS); - spi_eeprom_write(RID_CHAMBER_VOLUME_A, (int16_t) CHAMBER_VOLUME_A); - spi_eeprom_write(RID_CHAMBER_VOLUME_B, (int16_t) CHAMBER_VOLUME_B); - spi_eeprom_write(RID_PISTON_AREA_A, (int16_t) PISTON_AREA_A); - spi_eeprom_write(RID_PISTON_AREA_B, (int16_t) PISTON_AREA_B); - spi_eeprom_write(RID_PRES_SUPPLY, (int16_t) PRES_SUPPLY); - spi_eeprom_write(RID_PRES_RETURN, (int16_t) PRES_RETURN); - spi_eeprom_write(RID_ENC_LIMIT_MINUS, (int16_t) ENC_LIMIT_MINUS); - spi_eeprom_write(RID_ENC_LIMIT_PLUS, (int16_t) ENC_LIMIT_PLUS); - spi_eeprom_write(RID_STROKE, (int16_t) STROKE); - spi_eeprom_write(RID_VALVE_LIMIT_MINUS, (int16_t) VALVE_LIMIT_MINUS); - spi_eeprom_write(RID_VALVE_LIMIT_PLUS, (int16_t) VALVE_LIMIT_PLUS); - spi_eeprom_write(RID_ENC_PULSE_PER_POSITION, (int16_t) ENC_PULSE_PER_POSITION); - spi_eeprom_write(RID_TORQUE_SENSOR_PULSE_PER_TORQUE, (int16_t) TORQUE_SENSOR_PULSE_PER_TORQUE); + PRES_SENSOR_B_PULSE_PER_BAR = 4096.0 / 200.0; + spi_eeprom_ready(); + spi_eeprom_write(RID_PRES_SENSOR_B_PULSE_PER_BAR, (int) (PRES_SENSOR_B_PULSE_PER_BAR * 100.0)); + spi_eeprom_ready(); + PRES_SENSOR_B_PULSE_PER_BAR = (double) spi_eeprom_read(RID_PRES_SENSOR_B_PULSE_PER_BAR) * 0.01; + + spi_eeprom_ready(); + spi_eeprom_write(RID_FRICTION, (int) (FRICTION * 10.0)); + spi_eeprom_ready(); + FRICTION = (double) spi_eeprom_read(RID_FRICTION) / 10.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_HOMEPOS_OFFSET, (int) HOMEPOS_OFFSET); + spi_eeprom_ready(); + HOMEPOS_OFFSET = (int) spi_eeprom_read(RID_HOMEPOS_OFFSET); + + spi_eeprom_ready(); + spi_eeprom_write(RID_HOMEPOS_VALVE_OPENING, (int) HOMEPOS_VALVE_OPENING); + spi_eeprom_ready(); + HOMEPOS_VALVE_OPENING = (int) spi_eeprom_read(RID_HOMEPOS_VALVE_OPENING); + + spi_eeprom_ready(); + spi_eeprom_write(RID_TORQUE_SENSOR_VREF, (int) (TORQUE_VREF * 1000.0)); + spi_eeprom_ready(); + TORQUE_VREF = (double) spi_eeprom_read(RID_TORQUE_SENSOR_VREF) / 1000.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_PRES_A_SENSOR_VREF, (int) (PRES_A_VREF * 1000.0)); + spi_eeprom_ready(); + PRES_A_VREF = (double) spi_eeprom_read(RID_PRES_A_SENSOR_VREF) / 1000.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_PRES_B_SENSOR_VREF, (int) (PRES_B_VREF * 1000.0)); + spi_eeprom_ready(); + PRES_B_VREF = (double) spi_eeprom_read(RID_PRES_B_SENSOR_VREF) / 1000.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_GAIN_PLUS_1, (int) (VALVE_GAIN_LPM_PER_V[0] * 100.0)); + spi_eeprom_ready(); + VALVE_GAIN_LPM_PER_V[0] = (double) spi_eeprom_read(RID_VALVE_GAIN_PLUS_1) / 100.0; + spi_eeprom_ready(); - PRES_SENSOR_A_PULSE_PER_BAR = 4096.0 / 200.0; - PRES_SENSOR_A_PULSE_PER_BAR = 1.0; - //spi_eeprom_write(RID_PRES_SENSOR_A_PULSE_PER_BAR, (int16_t) (PRES_SENSOR_A_PULSE_PER_BAR * 100.0)); - spi_eeprom_write(RID_PRES_SENSOR_A_PULSE_PER_BAR, (int) (6)); + spi_eeprom_write(RID_VALVE_GAIN_PLUS_2, (int) (VALVE_GAIN_LPM_PER_V[2] * 100.0)); + spi_eeprom_ready(); + VALVE_GAIN_LPM_PER_V[2] = (double) spi_eeprom_read(RID_VALVE_GAIN_PLUS_2) / 100.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_GAIN_PLUS_3, (int) (VALVE_GAIN_LPM_PER_V[4] * 100.0)); + spi_eeprom_ready(); + VALVE_GAIN_LPM_PER_V[4] = (double) spi_eeprom_read(RID_VALVE_GAIN_PLUS_3) / 100.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_GAIN_PLUS_4, (int) (VALVE_GAIN_LPM_PER_V[6] * 100.0)); + spi_eeprom_ready(); + VALVE_GAIN_LPM_PER_V[6] = (double) spi_eeprom_read(RID_VALVE_GAIN_PLUS_4) / 100.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_GAIN_PLUS_5, (int) (VALVE_GAIN_LPM_PER_V[8] * 100.0)); + spi_eeprom_ready(); + VALVE_GAIN_LPM_PER_V[8] = (double) spi_eeprom_read(RID_VALVE_GAIN_PLUS_5) / 100.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_GAIN_MINUS_1, (int) (VALVE_GAIN_LPM_PER_V[1] * 100.0)); spi_eeprom_ready(); - PRES_SENSOR_B_PULSE_PER_BAR = 4096.0 / 200.0; - spi_eeprom_write(RID_PRES_SENSOR_B_PULSE_PER_BAR, (int16_t) (PRES_SENSOR_B_PULSE_PER_BAR * 100.0)); - spi_eeprom_write(RID_FRICTION, (int16_t) (FRICTION * 10.)); - spi_eeprom_write(RID_HOMEPOS_OFFSET, (int16_t) HOMEPOS_OFFSET); - spi_eeprom_write(RID_HOMEPOS_VALVE_OPENING, (int16_t) HOMEPOS_VALVE_OPENING); - spi_eeprom_write(RID_TORQUE_SENSOR_VREF, (int16_t) (TORQUE_VREF * 1000.0)); - spi_eeprom_write(RID_PRES_A_SENSOR_VREF, (int16_t) (PRES_A_VREF * 1000.0)); - spi_eeprom_write(RID_PRES_B_SENSOR_VREF, (int16_t) (PRES_B_VREF * 1000.0)); - spi_eeprom_write(RID_VALVE_GAIN_PLUS_1, (int16_t) (VALVE_GAIN_LPM_PER_V[0] * 100.0)); - spi_eeprom_write(RID_VALVE_GAIN_PLUS_2, (int16_t) (VALVE_GAIN_LPM_PER_V[2] * 100.0)); - spi_eeprom_write(RID_VALVE_GAIN_PLUS_3, (int16_t) (VALVE_GAIN_LPM_PER_V[4] * 100.0)); - spi_eeprom_write(RID_VALVE_GAIN_PLUS_4, (int16_t) (VALVE_GAIN_LPM_PER_V[6] * 100.0)); - spi_eeprom_write(RID_VALVE_GAIN_PLUS_5, (int16_t) (VALVE_GAIN_LPM_PER_V[8] * 100.0)); - spi_eeprom_write(RID_VALVE_GAIN_MINUS_1, (int16_t) (VALVE_GAIN_LPM_PER_V[1] * 100.0)); - spi_eeprom_write(RID_VALVE_GAIN_MINUS_2, (int16_t) (VALVE_GAIN_LPM_PER_V[3] * 100.0)); - spi_eeprom_write(RID_VALVE_GAIN_MINUS_3, (int16_t) (VALVE_GAIN_LPM_PER_V[5] * 100.0)); - spi_eeprom_write(RID_VALVE_GAIN_MINUS_4, (int16_t) (VALVE_GAIN_LPM_PER_V[7] * 100.0)); - spi_eeprom_write(RID_VALVE_GAIN_MINUS_5, (int16_t) (VALVE_GAIN_LPM_PER_V[9] * 100.0)); + VALVE_GAIN_LPM_PER_V[1] = (double) spi_eeprom_read(RID_VALVE_GAIN_MINUS_1) / 100.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_GAIN_MINUS_2, (int) (VALVE_GAIN_LPM_PER_V[3] * 100.0)); + spi_eeprom_ready(); + VALVE_GAIN_LPM_PER_V[3] = (double) spi_eeprom_read(RID_VALVE_GAIN_MINUS_2) / 100.0; + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_GAIN_MINUS_3, (int) (VALVE_GAIN_LPM_PER_V[5] * 100.0)); + spi_eeprom_ready(); + VALVE_GAIN_LPM_PER_V[5] = (double) spi_eeprom_read(RID_VALVE_GAIN_MINUS_3) / 100.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_GAIN_MINUS_4, (int) (VALVE_GAIN_LPM_PER_V[7] * 100.0)); + spi_eeprom_ready(); + VALVE_GAIN_LPM_PER_V[7] = (double) spi_eeprom_read(RID_VALVE_GAIN_MINUS_4) / 100.0; + + spi_eeprom_ready(); + spi_eeprom_write(RID_VALVE_GAIN_MINUS_5, (int) (VALVE_GAIN_LPM_PER_V[9] * 100.0)); + spi_eeprom_ready(); + VALVE_GAIN_LPM_PER_V[9] = (double) spi_eeprom_read(RID_VALVE_GAIN_MINUS_5) / 100.0; } @@ -453,7 +669,9 @@ ENC_PULSE_PER_POSITION = spi_eeprom_read(RID_ENC_PULSE_PER_POSITION); TORQUE_SENSOR_PULSE_PER_TORQUE = spi_eeprom_read(RID_TORQUE_SENSOR_PULSE_PER_TORQUE); + spi_eeprom_ready(); PRES_SENSOR_A_PULSE_PER_BAR = (double) spi_eeprom_read(RID_PRES_SENSOR_A_PULSE_PER_BAR) * 0.01; + spi_eeprom_ready(); PRES_SENSOR_B_PULSE_PER_BAR = (double) spi_eeprom_read(RID_PRES_SENSOR_B_PULSE_PER_BAR) * 0.01; FRICTION = (double) spi_eeprom_read(RID_FRICTION) / 10.0;