Make green LED flash instead of orange one, when inserting SD card

This commit is contained in:
Mario Hüttel 2020-08-17 22:26:29 +02:00
parent bdfaa67070
commit 277b28d7f5

View File

@ -130,8 +130,10 @@ static bool mount_sd_card_if_avail(bool mounted)
if (!sdio_check_inserted() && !mounted && inserted_counter > 4) { if (!sdio_check_inserted() && !mounted && inserted_counter > 4) {
inserted_counter = 0; inserted_counter = 0;
res = f_mount(fs_ptr, "0:/", 1); res = f_mount(fs_ptr, "0:/", 1);
if (res == FR_OK) if (res == FR_OK) {
led_set(1, 1);
return true; return true;
}
else else
return false; return false;
} }
@ -217,15 +219,10 @@ int main(void)
while (1) { while (1) {
if (systick_ticks_have_passed(quarter_sec_timestamp, 250)) { if (systick_ticks_have_passed(quarter_sec_timestamp, 250)) {
led_set(1, 0);
sd_old = sd_card_mounted; sd_old = sd_card_mounted;
sd_card_mounted = mount_sd_card_if_avail(sd_card_mounted); sd_card_mounted = mount_sd_card_if_avail(sd_card_mounted);
if (sd_old != sd_card_mounted) {
led_set(0, 1);
} else {
led_set(0, 0);
}
if (sd_card_mounted && !sd_old) { if (sd_card_mounted && !sd_old) {
adc_pt1000_get_resistance_calibration(NULL, NULL, &cal_active); adc_pt1000_get_resistance_calibration(NULL, NULL, &cal_active);
if (!cal_active) { if (!cal_active) {