|
|
@ -34,6 +34,37 @@ static void mf_init_all_subdevice_state() { |
|
|
|
port_led_b_set(false); |
|
|
|
} |
|
|
|
|
|
|
|
static void time_set_led_state(uint8_t led_num, bool state) { |
|
|
|
switch (led_num) { |
|
|
|
case 0: |
|
|
|
port_led0_set(state); |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
port_led0_set(state); |
|
|
|
port_led1_set(state); |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
port_led0_set(state); |
|
|
|
port_led1_set(state); |
|
|
|
port_led2_set(state); |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
port_led0_set(state); |
|
|
|
port_led1_set(state); |
|
|
|
port_led2_set(state); |
|
|
|
port_led3_set(state); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
printf("no more led\n"); |
|
|
|
port_led0_set(state); |
|
|
|
port_led1_set(state); |
|
|
|
port_led2_set(state); |
|
|
|
port_led3_set(state); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//开始工作 |
|
|
|
static void startwork() { port_fan_set(true); } |
|
|
|
//停止工作 |
|
|
@ -93,6 +124,10 @@ static void mf_process_timer_key(key_t *key) { |
|
|
|
this_device.configuration_start_time = systicket_get_now_ms(); |
|
|
|
this_device.configuration_mode = true; |
|
|
|
} else { |
|
|
|
this_device.time_led_num = this_device.time_led_num + 1; |
|
|
|
if (this_device.time_led_num > 3) { |
|
|
|
this_device.time_led_num = this_device.time_led_num - 3; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
@ -154,14 +189,14 @@ void configuration_shcedule() { |
|
|
|
static bool led_state; |
|
|
|
static uint32_t led_ticket = 0; |
|
|
|
if (this_device.configuration_mode == true) { |
|
|
|
if (systicket_haspassedms(this_device.configuration_start_time) > 1000) { |
|
|
|
if (systicket_haspassedms(this_device.configuration_start_time) > 2000) { |
|
|
|
this_device.configuration_mode = false; |
|
|
|
mf_init_all_subdevice_state(); |
|
|
|
time_set_led_state(this_device.time_led_num, true); |
|
|
|
} |
|
|
|
|
|
|
|
if (systicket_haspassedms(led_ticket) > 100) { |
|
|
|
led_ticket = systicket_get_now_ms(); |
|
|
|
port_led0_set(led_state); |
|
|
|
time_set_led_state(this_device.time_led_num, led_state); |
|
|
|
led_state = !led_state; |
|
|
|
} |
|
|
|
} |
|
|
|