X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fmicropeak-v2.0%2Fao_micro.c;h=efab12c315dd5f1cbbd9bfa8e605fc02d3c454bf;hp=5a21d6582a0e0fd24b1f75d07c2329a4d2059433;hb=HEAD;hpb=9a78fd63e8a1362af01d4f01e335ff449f0a5d7e diff --git a/src/micropeak-v2.0/ao_micro.c b/src/micropeak-v2.0/ao_micro.c index 5a21d658..d6349829 100644 --- a/src/micropeak-v2.0/ao_micro.c +++ b/src/micropeak-v2.0/ao_micro.c @@ -23,7 +23,6 @@ #include #include -uint32_t pa; alt_t ground_alt, max_alt; alt_t ao_max_height; @@ -51,14 +50,14 @@ ao_pa_get(void) ao_ms5607_sample(&ao_ms5607_current); ao_ms5607_convert(&ao_ms5607_current, &value); - pa = value.pres; + pa = (uint32_t) value.pres; } static void ao_compute_height(void) { - ground_alt = ao_pa_to_altitude(pa_ground); - max_alt = ao_pa_to_altitude(pa_min); + ground_alt = ao_pa_to_altitude((pres_t) pa_ground); + max_alt = ao_pa_to_altitude((pres_t) pa_min); ao_max_height = max_alt - ground_alt; } @@ -92,7 +91,7 @@ power_down(void) stm_scb.scr |= ((1 << STM_SCB_SCR_SLEEPDEEP) | (1 << STM_SCB_SCR_SLEEPONEXIT)); stm_pwr.cr |= (1 << STM_PWR_CR_PDDS); - stm_pwr.csr &= ~(1 << STM_PWR_CSR_WUF); + stm_pwr.csr &= ~(1UL << STM_PWR_CSR_WUF); ao_arch_wait_interrupt(); } } @@ -145,7 +144,7 @@ flight_mode(void) ao_report_altitude(); ao_pips(); log_micro_dump(); -#if BOOST_DELAY +#ifdef BOOST_DELAY ao_delay(BOOST_DELAY); #endif log_erase(); @@ -213,7 +212,7 @@ main(void) */ uint16_t vref = ao_adc_read_vref(); - uint32_t vdda = 3 * stm_vrefint_cal.vrefint_cal * 1000 / vref; + uint32_t vdda = 3UL * stm_vrefint_cal.vrefint_cal * 1000 / vref; /* Power supply > 3.25V means we're on USB power */ if (vdda > 3250) {