# HG changeset patch # User Dmitry Romanov # Date 1542797878 -10800 # Node ID e746bf846638c8895cf3efab79c8b1c717e9d109 # Parent cc41b5eaf1a7702780a1cf6a2930b10f8625eff9 tmp diff -r cc41b5eaf1a7 -r e746bf846638 Discovery/Src/data_exchange_main.c --- a/Discovery/Src/data_exchange_main.c Wed Nov 21 13:12:44 2018 +0300 +++ b/Discovery/Src/data_exchange_main.c Wed Nov 21 13:57:58 2018 +0300 @@ -306,8 +306,8 @@ uint8_t SPI_DMA_answer = 0; HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET); - delayMicros(10); - + delayMicros(50); //~exchange time(+20% reserve) + HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET); /* one cycle with NotChipSelect true to clear slave spi buffer */ if(data_old__lost_connection_to_slave_counter_temp >= 3) @@ -315,10 +315,10 @@ data_old__lost_connection_to_slave_counter_temp = 0; data_old__lost_connection_to_slave_counter_retry++; } - else - { - HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET); - } +// else +// { +// HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET); +// } DataEx_call_helper_requests(); @@ -327,7 +327,7 @@ //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_RESET); /* only for testing with Oscilloscope */ SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE+1); - HAL_Delay(3); +// HAL_Delay(3); if(SPI_DMA_answer != HAL_OK) DataEX_Error_Handler(SPI_DMA_answer); //HAL_Delay(3); diff -r cc41b5eaf1a7 -r e746bf846638 Discovery/Src/settings.c --- a/Discovery/Src/settings.c Wed Nov 21 13:12:44 2018 +0300 +++ b/Discovery/Src/settings.c Wed Nov 21 13:57:58 2018 +0300 @@ -55,7 +55,7 @@ { .versionFirst = 1, .versionSecond = 4, - .versionThird = 3, + .versionThird = 5, .versionBeta = 0, /* 4 bytes with trailing 0 */ diff -r cc41b5eaf1a7 -r e746bf846638 Small_CPU/Src/scheduler.c --- a/Small_CPU/Src/scheduler.c Wed Nov 21 13:12:44 2018 +0300 +++ b/Small_CPU/Src/scheduler.c Wed Nov 21 13:57:58 2018 +0300 @@ -182,8 +182,44 @@ void scheduleSpecial_Evaluate_DataSendToSlave(void) { + /* for device data updates */ + deviceDataFlashValid = 0; + memcpy(&DeviceDataFlash, &global.dataSendToSlave.data.DeviceData, sizeof(SDevice)); - global.dataSendToSlavePending = 0; + //TODO: (kittz) split by current mode. + + // new hw 170523 + if(global.I2C_SystemStatus != HAL_OK) + { + MX_I2C1_TestAndClear(); + MX_I2C1_Init(); + if(!is_init_pressure_done()) + { + init_pressure(); + } + } + + pressure_update(); + copyPressureData(); + compass_read(); + acceleration_read(); + compass_calc(); + battery_gas_gauge_get_data(); + copyCompassData(); + + copyCnsAndOtuData(); + copyTimeData(); + copyBatteryData(); + copyDeviceData(); + copyVpmCrushingData(); + + deviceDataFlashValid = 1; + scheduleUpdateDeviceData(); + + + + +// global.dataSendToSlavePending = 0; // if(!global.dataSendToSlaveIsValid) return; //TODO: WHAT THE FUCK?????!!!!! global.dataSendToMaster.confirmRequest.uw = 0; @@ -267,39 +303,6 @@ /* for simulation / testing */ global.ceiling_from_main_CPU_mbar = global.dataSendToSlave.data.ambient_pressure_mbar_ceiling; - /* for device data updates */ - deviceDataFlashValid = 0; - memcpy(&DeviceDataFlash, &global.dataSendToSlave.data.DeviceData, sizeof(SDevice)); - - //TODO: (kittz) split by current mode. - - // new hw 170523 - if(global.I2C_SystemStatus != HAL_OK) - { - MX_I2C1_TestAndClear(); - MX_I2C1_Init(); - if(!is_init_pressure_done()) - { - init_pressure(); - } - } - - pressure_update(); - copyPressureData(); - compass_read(); - acceleration_read(); - compass_calc(); - battery_gas_gauge_get_data(); - copyCompassData(); - - copyCnsAndOtuData(); - copyTimeData(); - copyBatteryData(); - copyDeviceData(); - copyVpmCrushingData(); - - deviceDataFlashValid = 1; - scheduleUpdateDeviceData(); } @@ -1183,27 +1186,27 @@ if(temperature_centigrad_int32 < global.deviceData.temperatureMinimum.value_int32) { global.deviceData.temperatureMinimum.value_int32 = temperature_centigrad_int32; - //WTF? scheduleSetDate(&global.deviceData.temperatureMinimum); + /*Last_change_time?*/ scheduleSetDate(&global.deviceData.temperatureMinimum); } if(temperature_centigrad_int32 > global.deviceData.temperatureMaximum.value_int32) { global.deviceData.temperatureMaximum.value_int32 = temperature_centigrad_int32; - //WTF? scheduleSetDate(&global.deviceData.temperatureMaximum); + /*Last_change_time?*/ 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; - //WTF? scheduleSetDate(&global.deviceData.depthMaximum); + /*Last_change_time?*/ 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; - //WTF? scheduleSetDate(&global.deviceData.voltageMinimum); + /*Last_change_time?*/ scheduleSetDate(&global.deviceData.voltageMinimum); } /* third step, counter */ @@ -1230,14 +1233,14 @@ void scheduleUpdateDeviceDataChargerFull(void) { global.deviceData.batteryChargeCompleteCycles.value_int32++; -//WTF? scheduleSetDate(&global.deviceData.batteryChargeCompleteCycles); + /*Last_change_time?*/ scheduleSetDate(&global.deviceData.batteryChargeCompleteCycles); } void scheduleUpdateDeviceDataChargerCharging(void) { global.deviceData.batteryChargeCycles.value_int32++; -//WTF? scheduleSetDate(&global.deviceData.batteryChargeCycles); + /*Last_change_time?*/ scheduleSetDate(&global.deviceData.batteryChargeCycles); } diff -r cc41b5eaf1a7 -r e746bf846638 ostc4pack/OSTC4_Firmware.bin Binary file ostc4pack/OSTC4_Firmware.bin has changed diff -r cc41b5eaf1a7 -r e746bf846638 ostc4pack/OSTC4_RTE.bin Binary file ostc4pack/OSTC4_RTE.bin has changed diff -r cc41b5eaf1a7 -r e746bf846638 ostc4pack/OSTC4_RTE_upload.bin Binary file ostc4pack/OSTC4_RTE_upload.bin has changed diff -r cc41b5eaf1a7 -r e746bf846638 ostc4pack/OSTC4_firmware_upload.bin Binary file ostc4pack/OSTC4_firmware_upload.bin has changed