Skip to content

Commit

Permalink
fix: 修复按键概率性失效的问题
Browse files Browse the repository at this point in the history
add: 恢复默认设置(无保存的wifi信息时)自动打开热点
  • Loading branch information
a2633063 committed Jun 9, 2020
1 parent cdb5b7c commit 8b1b4db
Show file tree
Hide file tree
Showing 9 changed files with 217,601 additions and 217,541 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ else
endif

BOOT?=new
APP?=1
APP?=2
SPI_SPEED?=40
SPI_MODE?=QIO
SPI_SIZE_MAP?=2
Expand Down
2 changes: 1 addition & 1 deletion app/include/user_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "os_type.h"

#define VERSION "v1.3.0"
#define VERSION "v1.3.1"

#define TYPE 2
#define TYPE_NAME "zDC1"
Expand Down
14 changes: 10 additions & 4 deletions app/user/user_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void ICACHE_FLASH_ATTR user_wifi_set(char *ssid, char *pass) {
os_timer_arm(&mdns_restart_timer, 1000, 0); //1000ms后重启
}
void ICACHE_FLASH_ATTR user_wifi_init(void) {
int i;
//设置为station模式
if (wifi_get_opmode() != STATION_MODE || wifi_get_opmode_default() != STATION_MODE) {
wifi_set_opmode(STATION_MODE);
Expand All @@ -197,15 +198,19 @@ void ICACHE_FLASH_ATTR user_wifi_init(void) {
os_sprintf(strName, DEVICE_NAME, hwaddr[4], hwaddr[5]);
wifi_station_set_hostname(strName);

if (gpio16_input_get()) {
struct station_config config[5];
i = wifi_station_get_ap_info(config);
os_printf("wifi info : %d \n", i);

if (gpio16_input_get() && i > 0) {
user_mqtt_init();
} else { //按住按键开机,为热点模式
wifi_status_led_uninstall();
user_set_led_wifi(1);
user_set_led_logo(1);

uint32 io_info[][3] = { { GPIO_WIFI_LED_IO_MUX, GPIO_WIFI_LED_IO_FUNC, GPIO_WIFI_LED_IO_NUM } };
uint32 pwm_duty_init[1] = {11111111};
uint32 pwm_duty_init[1] = { 11111111 };
pwm_init(1000000, pwm_duty_init, 1, io_info);
os_printf("pwm_init\n");
pwm_start();
Expand Down Expand Up @@ -260,7 +265,8 @@ void ICACHE_FLASH_ATTR user_smartconfig(void) {
void ICACHE_FLASH_ATTR user_smartconfig_stop(void) {
if (wifi_states == STATE_WIFI_SMARTCONFIG) {
smartconfig_stop();
wifi_states = STATE_WIFI_STAMODE_IDE;
if (wifi_states == STATE_WIFI_SMARTCONFIG)
wifi_states = STATE_WIFI_STAMODE_IDE;
os_printf("smartconfig stop");
wifi_status_led_uninstall();
user_set_led_wifi(0);
Expand All @@ -269,5 +275,5 @@ void ICACHE_FLASH_ATTR user_smartconfig_stop(void) {
}

bool ICACHE_FLASH_ATTR user_smartconfig_is_starting() {
return wifi_states == STATE_WIFI_STAMODE_IDE;
return wifi_states == STATE_WIFI_SMARTCONFIG;
}
Loading

0 comments on commit 8b1b4db

Please sign in to comment.