Mercurial > public > ostc4
comparison Small_CPU/Src/scheduler.c @ 84:e6abbef57475 kittz
Remove unusable code!!! prepare data for SPI in ONLY 1 IRQ!!!!
author | Dmitry Romanov <kitt@bk.ru> |
---|---|
date | Wed, 21 Nov 2018 10:25:15 +0300 |
parents | a6f0881074a4 |
children | 923c4566a2a1 |
comparison
equal
deleted
inserted
replaced
83:ef4f45df70c1 | 84:e6abbef57475 |
---|---|
179 } | 179 } |
180 | 180 |
181 | 181 |
182 void scheduleSpecial_Evaluate_DataSendToSlave(void) | 182 void scheduleSpecial_Evaluate_DataSendToSlave(void) |
183 { | 183 { |
184 | |
185 | |
184 global.dataSendToSlavePending = 0; | 186 global.dataSendToSlavePending = 0; |
185 if(!global.dataSendToSlaveIsValid) | 187 // if(!global.dataSendToSlaveIsValid) return; //TODO: WHAT THE FUCK?????!!!!! |
186 return; | |
187 | 188 |
188 global.dataSendToMaster.confirmRequest.uw = 0; | 189 global.dataSendToMaster.confirmRequest.uw = 0; |
189 | 190 |
190 if(TM_OTP_Read(0,0) == 0xFF) | 191 if(TM_OTP_Read(0,0) == 0xFF) |
191 { | 192 { |
267 global.ceiling_from_main_CPU_mbar = global.dataSendToSlave.data.ambient_pressure_mbar_ceiling; | 268 global.ceiling_from_main_CPU_mbar = global.dataSendToSlave.data.ambient_pressure_mbar_ceiling; |
268 | 269 |
269 /* for device data updates */ | 270 /* for device data updates */ |
270 deviceDataFlashValid = 0; | 271 deviceDataFlashValid = 0; |
271 memcpy(&DeviceDataFlash, &global.dataSendToSlave.data.DeviceData, sizeof(SDevice)); | 272 memcpy(&DeviceDataFlash, &global.dataSendToSlave.data.DeviceData, sizeof(SDevice)); |
273 | |
274 //TODO: (kittz) split by current mode. | |
275 copyCnsAndOtuData(); | |
276 copyTimeData(); | |
277 copyBatteryData(); | |
278 copyDeviceData(); | |
279 copyVpmCrushingData(); | |
280 | |
272 deviceDataFlashValid = 1; | 281 deviceDataFlashValid = 1; |
273 } | 282 } |
274 | 283 |
275 | 284 |
276 /** | 285 /** |
616 global.lifeData.counterSecondsShallowDepth = 0; | 625 global.lifeData.counterSecondsShallowDepth = 0; |
617 global.lifeData.dive_time_seconds_without_surface_time++; | 626 global.lifeData.dive_time_seconds_without_surface_time++; |
618 } | 627 } |
619 } // standard dive or DIVEMODE_Apnea | 628 } // standard dive or DIVEMODE_Apnea |
620 | 629 |
621 copyVpmCrushingData(); | 630 // copyVpmCrushingData(); |
622 copyTimeData(); | 631 // copyTimeData(); |
623 copyCnsAndOtuData(); | 632 // copyCnsAndOtuData(); |
624 copyBatteryData(); | 633 // copyBatteryData(); |
625 | 634 |
626 // new hw 170523 | 635 // new hw 170523 |
627 if(global.I2C_SystemStatus != HAL_OK) | 636 if(global.I2C_SystemStatus != HAL_OK) |
628 { | 637 { |
629 MX_I2C1_TestAndClear(); | 638 MX_I2C1_TestAndClear(); |
839 decom_oxygen_calculate_cns_degrade(&global.lifeData.cns, global.seconds_since_last_dive); | 848 decom_oxygen_calculate_cns_degrade(&global.lifeData.cns, global.seconds_since_last_dive); |
840 global.lifeData.desaturation_time_minutes = decom_calc_desaturation_time(global.lifeData.tissue_nitrogen_bar,global.lifeData.tissue_helium_bar,global.lifeData.pressure_surface_bar); | 849 global.lifeData.desaturation_time_minutes = decom_calc_desaturation_time(global.lifeData.tissue_nitrogen_bar,global.lifeData.tissue_helium_bar,global.lifeData.pressure_surface_bar); |
841 battery_charger_get_status_and_contral_battery_gas_gauge(0); | 850 battery_charger_get_status_and_contral_battery_gas_gauge(0); |
842 battery_gas_gauge_get_data(); | 851 battery_gas_gauge_get_data(); |
843 | 852 |
844 copyCnsAndOtuData(); | 853 // copyCnsAndOtuData(); |
845 copyTimeData(); | 854 // copyTimeData(); |
846 copyBatteryData(); | 855 // copyBatteryData(); |
847 copyDeviceData(); | 856 // copyDeviceData(); |
848 | 857 |
849 // new hw 170523 | 858 // new hw 170523 |
850 if(global.I2C_SystemStatus != HAL_OK) | 859 if(global.I2C_SystemStatus != HAL_OK) |
851 { | 860 { |
852 MX_I2C1_TestAndClear(); | 861 MX_I2C1_TestAndClear(); |
1150 | 1159 |
1151 temperature_centigrad_int32 = (int32_t)(get_temperature() * 100); | 1160 temperature_centigrad_int32 = (int32_t)(get_temperature() * 100); |
1152 if(temperature_centigrad_int32 < global.deviceData.temperatureMinimum.value_int32) | 1161 if(temperature_centigrad_int32 < global.deviceData.temperatureMinimum.value_int32) |
1153 { | 1162 { |
1154 global.deviceData.temperatureMinimum.value_int32 = temperature_centigrad_int32; | 1163 global.deviceData.temperatureMinimum.value_int32 = temperature_centigrad_int32; |
1155 scheduleSetDate(&global.deviceData.temperatureMinimum); | 1164 //WTF? scheduleSetDate(&global.deviceData.temperatureMinimum); |
1156 } | 1165 } |
1157 | 1166 |
1158 if(temperature_centigrad_int32 > global.deviceData.temperatureMaximum.value_int32) | 1167 if(temperature_centigrad_int32 > global.deviceData.temperatureMaximum.value_int32) |
1159 { | 1168 { |
1160 global.deviceData.temperatureMaximum.value_int32 = temperature_centigrad_int32; | 1169 global.deviceData.temperatureMaximum.value_int32 = temperature_centigrad_int32; |
1161 scheduleSetDate(&global.deviceData.temperatureMaximum); | 1170 //WTF? scheduleSetDate(&global.deviceData.temperatureMaximum); |
1162 } | 1171 } |
1163 | 1172 |
1164 pressure_mbar_int32 = (int32_t)get_pressure_mbar(); | 1173 pressure_mbar_int32 = (int32_t)get_pressure_mbar(); |
1165 if(pressure_mbar_int32 > global.deviceData.depthMaximum.value_int32) | 1174 if(pressure_mbar_int32 > global.deviceData.depthMaximum.value_int32) |
1166 { | 1175 { |
1167 global.deviceData.depthMaximum.value_int32 = pressure_mbar_int32; | 1176 global.deviceData.depthMaximum.value_int32 = pressure_mbar_int32; |
1168 scheduleSetDate(&global.deviceData.depthMaximum); | 1177 //WTF? scheduleSetDate(&global.deviceData.depthMaximum); |
1169 } | 1178 } |
1170 | 1179 |
1171 voltage_mvolt_int32 = (int32_t)(get_voltage() * 1000); | 1180 voltage_mvolt_int32 = (int32_t)(get_voltage() * 1000); |
1172 if(voltage_mvolt_int32 < global.deviceData.voltageMinimum.value_int32) | 1181 if(voltage_mvolt_int32 < global.deviceData.voltageMinimum.value_int32) |
1173 { | 1182 { |
1174 global.deviceData.voltageMinimum.value_int32 = voltage_mvolt_int32; | 1183 global.deviceData.voltageMinimum.value_int32 = voltage_mvolt_int32; |
1175 scheduleSetDate(&global.deviceData.voltageMinimum); | 1184 //WTF? scheduleSetDate(&global.deviceData.voltageMinimum); |
1176 } | 1185 } |
1177 | 1186 |
1178 /* third step, counter */ | 1187 /* third step, counter */ |
1179 switch (global.mode) | 1188 switch (global.mode) |
1180 { | 1189 { |
1197 | 1206 |
1198 | 1207 |
1199 void scheduleUpdateDeviceDataChargerFull(void) | 1208 void scheduleUpdateDeviceDataChargerFull(void) |
1200 { | 1209 { |
1201 global.deviceData.batteryChargeCompleteCycles.value_int32++; | 1210 global.deviceData.batteryChargeCompleteCycles.value_int32++; |
1202 scheduleSetDate(&global.deviceData.batteryChargeCompleteCycles); | 1211 //WTF? scheduleSetDate(&global.deviceData.batteryChargeCompleteCycles); |
1203 } | 1212 } |
1204 | 1213 |
1205 | 1214 |
1206 void scheduleUpdateDeviceDataChargerCharging(void) | 1215 void scheduleUpdateDeviceDataChargerCharging(void) |
1207 { | 1216 { |
1208 global.deviceData.batteryChargeCycles.value_int32++; | 1217 global.deviceData.batteryChargeCycles.value_int32++; |
1209 scheduleSetDate(&global.deviceData.batteryChargeCycles); | 1218 //WTF? scheduleSetDate(&global.deviceData.batteryChargeCycles); |
1210 } | 1219 } |
1211 | 1220 |
1212 | 1221 |
1213 /** | 1222 /** |
1214 ****************************************************************************** | 1223 ****************************************************************************** |