Mercurial > public > ostc4
changeset 90:83857eb3b12b kittz
+- stable
author | Dmitry Romanov <kitt@bk.ru> |
---|---|
date | Fri, 23 Nov 2018 18:14:56 +0300 |
parents | ff7775cc34c4 |
children | 8b0fadd413c6 |
files | Discovery/Src/data_exchange_main.c Discovery/Src/ostc.c Small_CPU/Src/baseCPU2.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 | 9 files changed, 53 insertions(+), 92 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Src/data_exchange_main.c Fri Nov 23 16:52:21 2018 +0300 +++ b/Discovery/Src/data_exchange_main.c Fri Nov 23 18:14:56 2018 +0300 @@ -306,7 +306,7 @@ uint8_t SPI_DMA_answer = 0; HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET); - delayMicros(30); //~exchange time(+20% reserve) + 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 */ @@ -457,9 +457,9 @@ return; if(stateUsed == stateRealGetPointer()) pStateUsed = stateRealGetPointerWrite(); - else + else{ pStateUsed = stateSimGetPointerWrite(); - + } if(decoLock == DECO_CALC_init_as_is_start_of_dive) {
--- a/Discovery/Src/ostc.c Fri Nov 23 16:52:21 2018 +0300 +++ b/Discovery/Src/ostc.c Fri Nov 23 18:14:56 2018 +0300 @@ -81,7 +81,7 @@ cpu2DmaSpi.Init.CLKPolarity = SPI_POLARITY_LOW; cpu2DmaSpi.Init.CLKPhase = SPI_PHASE_1EDGE; cpu2DmaSpi.Init.NSS = SPI_NSS_SOFT;//SPI_NSS_HARD_OUTPUT;//SPI_NSS_SOFT; - cpu2DmaSpi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_128; + cpu2DmaSpi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64; cpu2DmaSpi.Init.FirstBit = SPI_FIRSTBIT_MSB; cpu2DmaSpi.Init.TIMode = SPI_TIMODE_DISABLED; cpu2DmaSpi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;
--- a/Small_CPU/Src/baseCPU2.c Fri Nov 23 16:52:21 2018 +0300 +++ b/Small_CPU/Src/baseCPU2.c Fri Nov 23 18:14:56 2018 +0300 @@ -378,48 +378,10 @@ break; case MODE_CALIB: -// scheduleCompassCalibrationMode(); + scheduleCompassCalibrationMode(); break; case MODE_SURFACE: - - -// uint32_t tickstart = 0; -// uint32_t ticksdiff = 0; -// uint32_t lasttick = 0; -// tickstart = HAL_GetTick(); -// uint8_t counterPressure100msec = 0; -// uint8_t counterCompass100msec = 0; -// uint8_t counterAmbientLight100msec = 0; -// uint16_t counterWireless1msec = 0; -// uint16_t counter1ms=0; -// while (global.mode == MODE_SURFACE) { -// -// lasttick = HAL_GetTick(); -// ticksdiff = time_elapsed_ms(tickstart, lasttick); -// -// if (ticksdiff >= counter1ms) { -// -// global.lifeData.ascent_rate_meter_per_min = 0; -// counter1ms++; -// if(counter1ms>1000){ -// counter1ms=0; -// global.check_sync_not_running++; -// -// } -// -// } -// -// } - -// if(global.check_sync_not_running>10){ -// SPI_Start_single_TxRx_with_Master(); -// } -// schedule_check_resync(); -// pressure_update(); -// compass_read(); -// acceleration_read(); -// compass_calc(); scheduleSurfaceMode(); break; @@ -427,39 +389,39 @@ break; case MODE_DIVE: -// backup.no_fly_time_minutes = global.no_fly_time_minutes; -// backup.seconds_since_last_dive = global.seconds_since_last_dive; -// -// vpm_init( &global.vpm, global.conservatism, global.repetitive_dive, -// global.seconds_since_last_dive ); -// global.no_fly_time_minutes = 0; -// global.lifeData.dive_time_seconds = 0; -// global.lifeData.dive_time_seconds_without_surface_time = 0; -// scheduleDiveMode(); -// // done now in scheduler prior to change mode: global.seconds_since_last_dive = 1; -// -// if( global.lifeData.dive_time_seconds > 60 ) -// { -// //No Fly time 60% of desaturationtime after dive -// global.no_fly_time_minutes = decom_calc_desaturation_time( -// global.lifeData.tissue_nitrogen_bar, -// global.lifeData.tissue_helium_bar, -// global.lifeData.pressure_surface_bar ) * 60 / 100; -// if( global.no_fly_time_minutes < (24 * 60) ) -// global.no_fly_time_minutes = 24 * 60; -// } -// else -// { -// global.no_fly_time_minutes = backup.no_fly_time_minutes; -// global.seconds_since_last_dive = backup.seconds_since_last_dive; -// } -// -// global.lifeData.dive_time_seconds = 0; -// global.lifeData.dive_time_seconds_without_surface_time = 0; -// global.lifeData.counterSecondsShallowDepth = 0; -// -// backup.no_fly_time_minutes = 0; -// backup.seconds_since_last_dive = 0; + backup.no_fly_time_minutes = global.no_fly_time_minutes; + backup.seconds_since_last_dive = global.seconds_since_last_dive; + + vpm_init( &global.vpm, global.conservatism, global.repetitive_dive, + global.seconds_since_last_dive ); + global.no_fly_time_minutes = 0; + global.lifeData.dive_time_seconds = 0; + global.lifeData.dive_time_seconds_without_surface_time = 0; + scheduleDiveMode(); + // done now in scheduler prior to change mode: global.seconds_since_last_dive = 1; + + if( global.lifeData.dive_time_seconds > 60 ) + { + //No Fly time 60% of desaturationtime after dive + global.no_fly_time_minutes = decom_calc_desaturation_time( + global.lifeData.tissue_nitrogen_bar, + global.lifeData.tissue_helium_bar, + global.lifeData.pressure_surface_bar ) * 60 / 100; + if( global.no_fly_time_minutes < (24 * 60) ) + global.no_fly_time_minutes = 24 * 60; + } + else + { + global.no_fly_time_minutes = backup.no_fly_time_minutes; + global.seconds_since_last_dive = backup.seconds_since_last_dive; + } + + global.lifeData.dive_time_seconds = 0; + global.lifeData.dive_time_seconds_without_surface_time = 0; + global.lifeData.counterSecondsShallowDepth = 0; + + backup.no_fly_time_minutes = 0; + backup.seconds_since_last_dive = 0; break; case MODE_SHUTDOWN:
--- a/Small_CPU/Src/scheduler.c Fri Nov 23 16:52:21 2018 +0300 +++ b/Small_CPU/Src/scheduler.c Fri Nov 23 18:14:56 2018 +0300 @@ -181,7 +181,7 @@ void scheduleSpecial_Evaluate_DataSendToSlave(void) { - schedule_check_resync(); + global.dataSendToSlavePending = 0; if(!global.dataSendToSlaveIsValid) return; @@ -284,22 +284,22 @@ // pressure_update(); - +// // compass_read(); // acceleration_read(); // compass_calc(); - - -// copyPressureData(); -// battery_gas_gauge_get_data(); -// if(global.mode==MODE_CALIB)copyCompassData(); -// copyCnsAndOtuData(); -// copyTimeData(); -// copyBatteryData(); -// copyDeviceData(); -// copyVpmCrushingData(); -// deviceDataFlashValid = 1; -// scheduleUpdateDeviceData(); +// +// + copyPressureData(); + battery_gas_gauge_get_data(); + if(global.mode==MODE_CALIB)copyCompassData(); + copyCnsAndOtuData(); + copyTimeData(); + copyBatteryData(); + copyDeviceData(); + copyVpmCrushingData(); +// + scheduleUpdateDeviceData(); }
--- a/Small_CPU/Src/spi.c Fri Nov 23 16:52:21 2018 +0300 +++ b/Small_CPU/Src/spi.c Fri Nov 23 18:14:56 2018 +0300 @@ -124,7 +124,7 @@ hspi1.Init.CLKPolarity = SPI_POLARITY_LOW; hspi1.Init.CLKPhase = SPI_PHASE_1EDGE; hspi1.Init.NSS = SPI_NSS_HARD_INPUT; //SPI_NSS_SOFT; - hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_128; + hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64; hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB; hspi1.Init.TIMode = SPI_TIMODE_DISABLED; hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED; //_DISABLED; _ENABLED; @@ -325,7 +325,6 @@ // GPIO_new_DEBUG_LOW(); //For debug. global.dataSendToSlaveIsValid = 0; global.dataSendToSlaveIsNotValidCount++; - global.check_sync_not_running++; } global.dataSendToMaster.power_on_reset = 0; global.deviceDataSendToMaster.power_on_reset = 0;