Mercurial > public > ostc4
comparison Small_CPU/Src/pressure.c @ 942:06aaccaf2e02 Evo_2_23
Power down gnss module during dive:
The gnss modul will now be send to powerdown at the start of the dive. After end of dive the module returns to normal operation.
For development / test purpose a new simulated dive profile has been added.
author | Ideenmodellierer |
---|---|
date | Mon, 16 Dec 2024 19:09:00 +0100 |
parents | 3311b720a072 |
children |
comparison
equal
deleted
inserted
replaced
941:6d8ae8fbccf5 | 942:06aaccaf2e02 |
---|---|
47 #define CMD_PROM_RD 0xA0 // Prom read command | 47 #define CMD_PROM_RD 0xA0 // Prom read command |
48 | 48 |
49 /* remove comment to use a predefined profile for pressure changes instead of real world data */ | 49 /* remove comment to use a predefined profile for pressure changes instead of real world data */ |
50 /* #define SIMULATE_PRESSURE */ | 50 /* #define SIMULATE_PRESSURE */ |
51 | 51 |
52 | |
53 #define PRESSURE_SURFACE_MAX_MBAR (1060.0f) /* It is unlikely that pressure at surface is greater than this value => clip to it */ | 52 #define PRESSURE_SURFACE_MAX_MBAR (1060.0f) /* It is unlikely that pressure at surface is greater than this value => clip to it */ |
54 | 53 |
55 #define PRESSURE_MINIMUM (0.0f) | 54 #define PRESSURE_MINIMUM (0.0f) |
56 #define TEMPERATURE_MINIMUM (-100.0f) | 55 #define TEMPERATURE_MINIMUM (-100.0f) |
57 | 56 |
562 passedSecond++; | 561 passedSecond++; |
563 lastsecondtick = lasttick; | 562 lastsecondtick = lasttick; |
564 } | 563 } |
565 secondtick = lasttick; | 564 secondtick = lasttick; |
566 | 565 |
567 #define DIVE_AT_SPEED 1 | 566 #define DIVE_EASY 1 |
568 #ifdef DIVE_AFTER_LANDING | 567 #ifdef DIVE_AFTER_LANDING |
569 if(passedSecond < 10) pressure_sim_mbar = 1000.0; /* stay stable for 10 seconds */ | 568 if(passedSecond < 10) pressure_sim_mbar = 1000.0; /* stay stable for 10 seconds */ |
570 else if(passedSecond < 300) pressure_sim_mbar -= 1.0; /* decrease pressure in 5 minutes target 770mbar => delta 330 */ | 569 else if(passedSecond < 300) pressure_sim_mbar -= 1.0; /* decrease pressure in 5 minutes target 770mbar => delta 330 */ |
571 else if(passedSecond < 900) pressure_sim_mbar += 0.0; /*stay stable 10 minutes*/ | 570 else if(passedSecond < 900) pressure_sim_mbar += 0.0; /*stay stable 10 minutes*/ |
572 else if(passedSecond < 1500) pressure_sim_mbar += 0.5; /* return to 1 bar in 10 Minutes*/ | 571 else if(passedSecond < 1500) pressure_sim_mbar += 0.5; /* return to 1 bar in 10 Minutes*/ |
574 else if(passedSecond < 2000) pressure_sim_mbar += 10.0; /* start dive */ | 573 else if(passedSecond < 2000) pressure_sim_mbar += 10.0; /* start dive */ |
575 else if(passedSecond < 2300) pressure_sim_mbar += 0.0; /* stay on depth */ | 574 else if(passedSecond < 2300) pressure_sim_mbar += 0.0; /* stay on depth */ |
576 else if(passedSecond < 2500) pressure_sim_mbar -= 10.0; /* return to surface */ | 575 else if(passedSecond < 2500) pressure_sim_mbar -= 10.0; /* return to surface */ |
577 else pressure_sim_mbar = 1000.0; /* final state */ | 576 else pressure_sim_mbar = 1000.0; /* final state */ |
578 #endif | 577 #endif |
579 #ifdef DIVE_AT_SPEED | 578 #ifdef DIVE_EASY |
579 if(passedSecond < 10) pressure_sim_mbar = 1000.0; /* stay stable for 10 seconds */ | |
580 else if(passedSecond < 120) pressure_sim_mbar += 1.0; /* decrease pressure in 2 minutes */ | |
581 else if(passedSecond < 240) pressure_sim_mbar += 0.0; /*stay stable 2 minutes*/ | |
582 else if(passedSecond < 360) pressure_sim_mbar -= 1.0; /* return to 1 bar in 2 Minutes*/ | |
583 else pressure_sim_mbar = 1000.0; /* final state */ | |
584 #endif | |
585 #if DIVE_AT_SPEED | |
580 if(passedSecond < 10) pressure_sim_mbar = 1000.0; /* stay stable for 10 seconds */ | 586 if(passedSecond < 10) pressure_sim_mbar = 1000.0; /* stay stable for 10 seconds */ |
581 else if(passedSecond < 20) delta_mbar = 200.0 / SECDIV; /* Start dive */ | 587 else if(passedSecond < 20) delta_mbar = 200.0 / SECDIV; /* Start dive */ |
582 else if(passedSecond < 30) delta_mbar = 0.0; /*stay on depth*/ | 588 else if(passedSecond < 30) delta_mbar = 0.0; /*stay on depth*/ |
583 else if(passedSecond < 45) delta_mbar -= 0.2 / SECDIV; /* return to surface */ | 589 else if(passedSecond < 45) delta_mbar -= 0.2 / SECDIV; /* return to surface */ |
584 else if(passedSecond < 40) delta_mbar -= 0.4 / SECDIV; /* stay */ | 590 else if(passedSecond < 40) delta_mbar -= 0.4 / SECDIV; /* stay */ |
592 pressure_sim_mbar += delta_mbar; | 598 pressure_sim_mbar += delta_mbar; |
593 if(pressure_sim_mbar < surface_pressure_mbar) | 599 if(pressure_sim_mbar < surface_pressure_mbar) |
594 { | 600 { |
595 pressure_sim_mbar = surface_pressure_mbar; | 601 pressure_sim_mbar = surface_pressure_mbar; |
596 } | 602 } |
597 | 603 #endif |
598 #else /* short dive */ | 604 #ifdef SHORTDIVE /* short dive */ |
599 if(passedSecond < 10) pressure_sim_mbar = 1000.0; /* stay stable for 10 seconds */ | 605 if(passedSecond < 10) pressure_sim_mbar = 1000.0; /* stay stable for 10 seconds */ |
600 else if(passedSecond < 180) pressure_sim_mbar += 10.0; /* Start dive */ | 606 else if(passedSecond < 180) pressure_sim_mbar += 10.0; /* Start dive */ |
601 else if(passedSecond < 300) pressure_sim_mbar += 0.0; /*stay on depth*/ | 607 else if(passedSecond < 300) pressure_sim_mbar += 0.0; /*stay on depth*/ |
602 else if(passedSecond < 460) pressure_sim_mbar -= 10.0; /* return to surface */ | 608 else if(passedSecond < 460) pressure_sim_mbar -= 10.0; /* return to surface */ |
603 else if(passedSecond < 600) pressure_sim_mbar += 0.0; /* stay */ | 609 else if(passedSecond < 600) pressure_sim_mbar += 0.0; /* stay */ |