comparison Small_CPU/Src/baseCPU2.c @ 90:83857eb3b12b kittz

+- stable
author Dmitry Romanov <kitt@bk.ru>
date Fri, 23 Nov 2018 18:14:56 +0300
parents ff7775cc34c4
children b364c75005bb
comparison
equal deleted inserted replaced
89:ff7775cc34c4 90:83857eb3b12b
376 */ 376 */
377 global.mode = MODE_SURFACE; 377 global.mode = MODE_SURFACE;
378 break; 378 break;
379 379
380 case MODE_CALIB: 380 case MODE_CALIB:
381 // scheduleCompassCalibrationMode(); 381 scheduleCompassCalibrationMode();
382 break; 382 break;
383 383
384 case MODE_SURFACE: 384 case MODE_SURFACE:
385
386
387 // uint32_t tickstart = 0;
388 // uint32_t ticksdiff = 0;
389 // uint32_t lasttick = 0;
390 // tickstart = HAL_GetTick();
391 // uint8_t counterPressure100msec = 0;
392 // uint8_t counterCompass100msec = 0;
393 // uint8_t counterAmbientLight100msec = 0;
394 // uint16_t counterWireless1msec = 0;
395 // uint16_t counter1ms=0;
396 // while (global.mode == MODE_SURFACE) {
397 //
398 // lasttick = HAL_GetTick();
399 // ticksdiff = time_elapsed_ms(tickstart, lasttick);
400 //
401 // if (ticksdiff >= counter1ms) {
402 //
403 // global.lifeData.ascent_rate_meter_per_min = 0;
404 // counter1ms++;
405 // if(counter1ms>1000){
406 // counter1ms=0;
407 // global.check_sync_not_running++;
408 //
409 // }
410 //
411 // }
412 //
413 // }
414
415 // if(global.check_sync_not_running>10){
416 // SPI_Start_single_TxRx_with_Master();
417 // }
418 // schedule_check_resync();
419 // pressure_update();
420 // compass_read();
421 // acceleration_read();
422 // compass_calc();
423 scheduleSurfaceMode(); 385 scheduleSurfaceMode();
424 break; 386 break;
425 387
426 case MODE_TEST: 388 case MODE_TEST:
427 break; 389 break;
428 390
429 case MODE_DIVE: 391 case MODE_DIVE:
430 // backup.no_fly_time_minutes = global.no_fly_time_minutes; 392 backup.no_fly_time_minutes = global.no_fly_time_minutes;
431 // backup.seconds_since_last_dive = global.seconds_since_last_dive; 393 backup.seconds_since_last_dive = global.seconds_since_last_dive;
432 // 394
433 // vpm_init( &global.vpm, global.conservatism, global.repetitive_dive, 395 vpm_init( &global.vpm, global.conservatism, global.repetitive_dive,
434 // global.seconds_since_last_dive ); 396 global.seconds_since_last_dive );
435 // global.no_fly_time_minutes = 0; 397 global.no_fly_time_minutes = 0;
436 // global.lifeData.dive_time_seconds = 0; 398 global.lifeData.dive_time_seconds = 0;
437 // global.lifeData.dive_time_seconds_without_surface_time = 0; 399 global.lifeData.dive_time_seconds_without_surface_time = 0;
438 // scheduleDiveMode(); 400 scheduleDiveMode();
439 // // done now in scheduler prior to change mode: global.seconds_since_last_dive = 1; 401 // done now in scheduler prior to change mode: global.seconds_since_last_dive = 1;
440 // 402
441 // if( global.lifeData.dive_time_seconds > 60 ) 403 if( global.lifeData.dive_time_seconds > 60 )
442 // { 404 {
443 // //No Fly time 60% of desaturationtime after dive 405 //No Fly time 60% of desaturationtime after dive
444 // global.no_fly_time_minutes = decom_calc_desaturation_time( 406 global.no_fly_time_minutes = decom_calc_desaturation_time(
445 // global.lifeData.tissue_nitrogen_bar, 407 global.lifeData.tissue_nitrogen_bar,
446 // global.lifeData.tissue_helium_bar, 408 global.lifeData.tissue_helium_bar,
447 // global.lifeData.pressure_surface_bar ) * 60 / 100; 409 global.lifeData.pressure_surface_bar ) * 60 / 100;
448 // if( global.no_fly_time_minutes < (24 * 60) ) 410 if( global.no_fly_time_minutes < (24 * 60) )
449 // global.no_fly_time_minutes = 24 * 60; 411 global.no_fly_time_minutes = 24 * 60;
450 // } 412 }
451 // else 413 else
452 // { 414 {
453 // global.no_fly_time_minutes = backup.no_fly_time_minutes; 415 global.no_fly_time_minutes = backup.no_fly_time_minutes;
454 // global.seconds_since_last_dive = backup.seconds_since_last_dive; 416 global.seconds_since_last_dive = backup.seconds_since_last_dive;
455 // } 417 }
456 // 418
457 // global.lifeData.dive_time_seconds = 0; 419 global.lifeData.dive_time_seconds = 0;
458 // global.lifeData.dive_time_seconds_without_surface_time = 0; 420 global.lifeData.dive_time_seconds_without_surface_time = 0;
459 // global.lifeData.counterSecondsShallowDepth = 0; 421 global.lifeData.counterSecondsShallowDepth = 0;
460 // 422
461 // backup.no_fly_time_minutes = 0; 423 backup.no_fly_time_minutes = 0;
462 // backup.seconds_since_last_dive = 0; 424 backup.seconds_since_last_dive = 0;
463 break; 425 break;
464 426
465 case MODE_SHUTDOWN: 427 case MODE_SHUTDOWN:
466 HAL_Delay(200); 428 HAL_Delay(200);
467 global.mode = MODE_SLEEP; 429 global.mode = MODE_SLEEP;