![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Used for calibration consumables
Dependencies: mbed MODSERIAL FastPWM ADS8568_ADC
Diff: main.cpp
- Revision:
- 20:ab2d7aa17a20
- Parent:
- 17:25831977b98e
- Child:
- 21:4833e7fbcec7
diff -r c8e67359370a -r ab2d7aa17a20 main.cpp --- a/main.cpp Thu Sep 19 16:19:37 2019 +0000 +++ b/main.cpp Fri Sep 20 09:26:43 2019 +0000 @@ -28,11 +28,11 @@ {0x00000000, 0x00000000, 0x00000000}, {0x00000000, 0x00000000, 0x00000000}}; -float drive_board_cal[UID_TABLE_LENGTH][2] = - {{0.0, 1.0}, - {0.0, 1.0}, - {0.0, 1.0}, - {0.0, 1.0}}; +float drive_board_cal[UID_TABLE_LENGTH][2][2] = + {{{0.0, 1.0}, {0.0, 1.0}}, + {{0.0, 1.0}, {0.0, 1.0}}, + {{0.0, 1.0}, {0.0, 1.0}}, + {{0.0, 1.0}, {0.0, 1.0}}}; MODSERIAL pc(PA_9, PA_10, BUFFER_SIZE); //mcu TX, RX, BUFFER_SIZE byte TX and RX buffers @@ -92,7 +92,7 @@ { if (uid[0]==drive_board_uid[i][0] && uid[1]==drive_board_uid[i][1] && uid[2]==drive_board_uid[i][2]) { - i_board = drive_board_serial_number[i]; + i_board = i; i = UID_TABLE_LENGTH; } } @@ -139,13 +139,13 @@ v[iHeater] = adc.read_channel_result(v_port[iHeater]); r_adc[iHeater] = (float)v[iHeater]/(float)curr[iHeater]; if (i_board > 0) - r_ohm[iHeater] = drive_board_cal[i_board][0] + r_adc[iHeater]*drive_board_cal[i_board][1]; + r_ohm[iHeater] = drive_board_cal[i_board][iHeater][0] + r_adc[iHeater]*drive_board_cal[i_board][iHeater][1]; else r_ohm[iHeater] = 0.0; //Write output for iHeater - pc.printf("%10d, %10d, %10.6f, %10.6f", curr[iHeater], v[iHeater], r_adc[iHeater], r_ohm[iHeater]); + pc.printf("%10d, %10d, %10.6f, %10.6f,", curr[iHeater], v[iHeater], r_adc[iHeater], r_ohm[iHeater]); } pc.printf("\n"); wait_ms(LOG_INTERVAL);