Mercurial > public > ostc4
changeset 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 | ef4f45df70c1 |
children | 923c4566a2a1 |
files | Discovery/Src/settings.c Discovery/Src/tHome.c Small_CPU/Inc/scheduler.h Small_CPU/Src/baseCPU2.c Small_CPU/Src/i2c.c Small_CPU/Src/scheduler.c Small_CPU/Src/spi.c ostc4pack/OSTC4_Firmware.bin ostc4pack/OSTC4_RTE.bin ostc4pack/OSTC4_RTE_upload.bin ostc4pack/OSTC4_firmware_upload.bin |
diffstat | 11 files changed, 58 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Src/settings.c Tue Nov 20 12:27:40 2018 +0300 +++ b/Discovery/Src/settings.c Wed Nov 21 10:25:15 2018 +0300 @@ -55,7 +55,7 @@ { .versionFirst = 1, .versionSecond = 4, - .versionThird = 1, + .versionThird = 2, .versionBeta = 0, /* 4 bytes with trailing 0 */
--- a/Discovery/Src/tHome.c Tue Nov 20 12:27:40 2018 +0300 +++ b/Discovery/Src/tHome.c Wed Nov 21 10:25:15 2018 +0300 @@ -455,11 +455,8 @@ snprintf(text,10,"\002%X%X%X%X",dataIn->footer.checkCode[0],dataIn->footer.checkCode[1],dataIn->footer.checkCode[2],dataIn->footer.checkCode[3]); Gfx_write_label_var(ScreenToWriteOn, 600,800, 60,&FontT24,CLUT_ButtonSymbols,text); - snprintf(text,10,"---"); - Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); - - snprintf(text,10,"cpt:\002%i",get_num_SPI_CALLBACKS()); - Gfx_write_label_var(ScreenToWriteOn, 600,800, 120,&FontT24,CLUT_ButtonSymbols,text); + snprintf(text,10,"cpt:\002%i",get_num_SPI_CALLBACKS()); + Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); // snprintf(text,10,"i2c:\002%i",get_DataEX_Error_place()); // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text);
--- a/Small_CPU/Inc/scheduler.h Tue Nov 20 12:27:40 2018 +0300 +++ b/Small_CPU/Inc/scheduler.h Wed Nov 21 10:25:15 2018 +0300 @@ -53,7 +53,7 @@ _Bool demo_mode; uint8_t dataSendToSlaveIsValid; uint8_t dataSendToSlavePending; - uint8_t dataSendToSlaveStopEval; + uint8_t dataUpdateIsNeeded; uint32_t sync_error_count; uint32_t check_sync_not_running; uint8_t ButtonResponsiveness[4];
--- a/Small_CPU/Src/baseCPU2.c Tue Nov 20 12:27:40 2018 +0300 +++ b/Small_CPU/Src/baseCPU2.c Wed Nov 21 10:25:15 2018 +0300 @@ -387,7 +387,7 @@ MX_DMA_Init(); MX_SPI1_Init(); MX_EXTI_wireless_Init(); - SPI_Start_single_TxRx_with_Master(); +// SPI_Start_single_TxRx_with_Master(); EXTI_Test_Button_Init(); /* @@ -414,7 +414,7 @@ MX_DMA_Init(); MX_SPI1_Init(); // MX_EXTI_wireless_Init(); - SPI_Start_single_TxRx_with_Master(); +// SPI_Start_single_TxRx_with_Master(); // EXTI_Test_Button_Init(); scheduleTestMode(); @@ -496,7 +496,7 @@ MX_DMA_Init(); MX_SPI1_Init(); MX_EXTI_wireless_Init(); - SPI_Start_single_TxRx_with_Master(); +// SPI_Start_single_TxRx_with_Master(); // EXTILine0_Button_DeInit(); not now, later after testing break;
--- a/Small_CPU/Src/i2c.c Tue Nov 20 12:27:40 2018 +0300 +++ b/Small_CPU/Src/i2c.c Wed Nov 21 10:25:15 2018 +0300 @@ -76,17 +76,16 @@ I2cHandle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED; I2cHandle.Init.OwnAddress1 = 0x01; - global.dataSendToSlaveStopEval = 1; global.I2C_SystemStatus = HAL_I2C_Init(&I2cHandle); HAL_I2CEx_AnalogFilter_Config(&I2cHandle, I2C_ANALOGFILTER_ENABLED); - global.dataSendToSlaveStopEval = 0; - if(global.dataSendToSlavePending) - { - scheduleSpecial_Evaluate_DataSendToSlave(); - } +// if(global.dataSendToSlavePending) +// { +// scheduleSpecial_Evaluate_DataSendToSlave(); +// } + global.dataUpdateIsNeeded = 1; return (HAL_StatusTypeDef)global.I2C_SystemStatus; } @@ -110,18 +109,19 @@ if(global.I2C_SystemStatus != HAL_OK) return (HAL_StatusTypeDef)global.I2C_SystemStatus; - global.dataSendToSlaveStopEval = 1; + global.I2C_SystemStatus = HAL_I2C_Master_Transmit(&I2cHandle, DevAddress, pData, Size, 100 /*FIXME , 0*/); if(global.I2C_SystemStatus != HAL_OK) { I2C_Error_count(); } - global.dataSendToSlaveStopEval = 0; - if(global.dataSendToSlavePending) - { - scheduleSpecial_Evaluate_DataSendToSlave(); - } + +// if(global.dataSendToSlavePending) +// { +// scheduleSpecial_Evaluate_DataSendToSlave(); +// } + global.dataUpdateIsNeeded = 1; return (HAL_StatusTypeDef)global.I2C_SystemStatus; } @@ -132,7 +132,7 @@ return (HAL_StatusTypeDef)(global.I2C_SystemStatus & 0x03); - global.dataSendToSlaveStopEval = 1; + global.I2C_SystemStatus = HAL_I2C_Master_Transmit(&I2cHandle, DevAddress, pData, Size, 100 /*FIXME , 1*/); if(global.I2C_SystemStatus != HAL_OK) @@ -140,12 +140,12 @@ I2C_Error_count(); } - global.dataSendToSlaveStopEval = 0; - if(global.dataSendToSlavePending) - { - scheduleSpecial_Evaluate_DataSendToSlave(); - } - +// if(global.dataSendToSlavePending) +// { +// scheduleSpecial_Evaluate_DataSendToSlave(); +// } +// + global.dataUpdateIsNeeded = 1; return (HAL_StatusTypeDef)global.I2C_SystemStatus; } @@ -157,7 +157,6 @@ uint8_t localHALstatusReturn = 0xFF; - global.dataSendToSlaveStopEval = 1; localHALstatusReturn = HAL_I2C_Master_Receive(&I2cHandle, DevAddress, pData, Size, 100); if(localHALstatusReturn != HAL_OK) @@ -165,11 +164,11 @@ I2C_Error_count(); } - global.dataSendToSlaveStopEval = 0; - if(global.dataSendToSlavePending) - { - scheduleSpecial_Evaluate_DataSendToSlave(); - } + global.dataUpdateIsNeeded = 1; +// if(global.dataSendToSlavePending) +// { +// scheduleSpecial_Evaluate_DataSendToSlave(); +// } return (HAL_StatusTypeDef)localHALstatusReturn; }
--- a/Small_CPU/Src/scheduler.c Tue Nov 20 12:27:40 2018 +0300 +++ b/Small_CPU/Src/scheduler.c Wed Nov 21 10:25:15 2018 +0300 @@ -181,9 +181,10 @@ void scheduleSpecial_Evaluate_DataSendToSlave(void) { + + global.dataSendToSlavePending = 0; - if(!global.dataSendToSlaveIsValid) - return; +// if(!global.dataSendToSlaveIsValid) return; //TODO: WHAT THE FUCK?????!!!!! global.dataSendToMaster.confirmRequest.uw = 0; @@ -269,6 +270,14 @@ /* for device data updates */ deviceDataFlashValid = 0; memcpy(&DeviceDataFlash, &global.dataSendToSlave.data.DeviceData, sizeof(SDevice)); + + //TODO: (kittz) split by current mode. + copyCnsAndOtuData(); + copyTimeData(); + copyBatteryData(); + copyDeviceData(); + copyVpmCrushingData(); + deviceDataFlashValid = 1; } @@ -618,10 +627,10 @@ } } // standard dive or DIVEMODE_Apnea - copyVpmCrushingData(); - copyTimeData(); - copyCnsAndOtuData(); - copyBatteryData(); +// copyVpmCrushingData(); +// copyTimeData(); +// copyCnsAndOtuData(); +// copyBatteryData(); // new hw 170523 if(global.I2C_SystemStatus != HAL_OK) @@ -841,10 +850,10 @@ battery_charger_get_status_and_contral_battery_gas_gauge(0); battery_gas_gauge_get_data(); - copyCnsAndOtuData(); - copyTimeData(); - copyBatteryData(); - copyDeviceData(); +// copyCnsAndOtuData(); +// copyTimeData(); +// copyBatteryData(); +// copyDeviceData(); // new hw 170523 if(global.I2C_SystemStatus != HAL_OK) @@ -1152,27 +1161,27 @@ if(temperature_centigrad_int32 < global.deviceData.temperatureMinimum.value_int32) { global.deviceData.temperatureMinimum.value_int32 = temperature_centigrad_int32; - scheduleSetDate(&global.deviceData.temperatureMinimum); + //WTF? scheduleSetDate(&global.deviceData.temperatureMinimum); } if(temperature_centigrad_int32 > global.deviceData.temperatureMaximum.value_int32) { global.deviceData.temperatureMaximum.value_int32 = temperature_centigrad_int32; - scheduleSetDate(&global.deviceData.temperatureMaximum); + //WTF? scheduleSetDate(&global.deviceData.temperatureMaximum); } pressure_mbar_int32 = (int32_t)get_pressure_mbar(); if(pressure_mbar_int32 > global.deviceData.depthMaximum.value_int32) { global.deviceData.depthMaximum.value_int32 = pressure_mbar_int32; - scheduleSetDate(&global.deviceData.depthMaximum); + //WTF? scheduleSetDate(&global.deviceData.depthMaximum); } voltage_mvolt_int32 = (int32_t)(get_voltage() * 1000); if(voltage_mvolt_int32 < global.deviceData.voltageMinimum.value_int32) { global.deviceData.voltageMinimum.value_int32 = voltage_mvolt_int32; - scheduleSetDate(&global.deviceData.voltageMinimum); + //WTF? scheduleSetDate(&global.deviceData.voltageMinimum); } /* third step, counter */ @@ -1199,14 +1208,14 @@ void scheduleUpdateDeviceDataChargerFull(void) { global.deviceData.batteryChargeCompleteCycles.value_int32++; - scheduleSetDate(&global.deviceData.batteryChargeCompleteCycles); +//WTF? scheduleSetDate(&global.deviceData.batteryChargeCompleteCycles); } void scheduleUpdateDeviceDataChargerCharging(void) { global.deviceData.batteryChargeCycles.value_int32++; - scheduleSetDate(&global.deviceData.batteryChargeCycles); +//WTF? scheduleSetDate(&global.deviceData.batteryChargeCycles); }
--- a/Small_CPU/Src/spi.c Tue Nov 20 12:27:40 2018 +0300 +++ b/Small_CPU/Src/spi.c Wed Nov 21 10:25:15 2018 +0300 @@ -369,9 +369,10 @@ } global.dataSendToMaster.power_on_reset = 0; global.deviceDataSendToMaster.power_on_reset = 0; - if(!global.dataSendToSlaveStopEval) + if(global.dataUpdateIsNeeded) { scheduleSpecial_Evaluate_DataSendToSlave(); + global.dataUpdateIsNeeded=0; } SPI_Start_single_TxRx_with_Master(); }