Browse Source

update

master
zwsd 3 years ago
parent
commit
a1307a5187
  1. 41
      APP/main.c
  2. 3
      APP/this_device.h

41
APP/main.c

@ -34,6 +34,37 @@ static void mf_init_all_subdevice_state() {
port_led_b_set(false); 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); } 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_start_time = systicket_get_now_ms();
this_device.configuration_mode = true; this_device.configuration_mode = true;
} else { } 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; return;
@ -154,14 +189,14 @@ void configuration_shcedule() {
static bool led_state; static bool led_state;
static uint32_t led_ticket = 0; static uint32_t led_ticket = 0;
if (this_device.configuration_mode == true) { 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; 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) { if (systicket_haspassedms(led_ticket) > 100) {
led_ticket = systicket_get_now_ms(); 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; led_state = !led_state;
} }
} }

3
APP/this_device.h

@ -20,4 +20,7 @@ typedef struct {
bool configuration_mode; bool configuration_mode;
uint32_t configuration_start_time; uint32_t configuration_start_time;
uint8_t time_led_num;
} ThisDevice_t; } ThisDevice_t;
Loading…
Cancel
Save