This commit is contained in:
pvvx 2017-06-28 07:09:45 +03:00
parent b8c699eb1c
commit 3a865fb51d
40 changed files with 293 additions and 463 deletions

View file

@ -108,10 +108,10 @@ extern uint32_t SystemCoreClock;
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_ALTERNATIVE_API 0
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configCHECK_FOR_STACK_OVERFLOW 0
#define configUSE_RECURSIVE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 0
#define configGENERATE_RUN_TIME_STATS 1
#define configGENERATE_RUN_TIME_STATS 0
#if configGENERATE_RUN_TIME_STATS
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
@ -161,7 +161,7 @@ extern int freertos_ready_to_sleep();
#define traceLOW_POWER_IDLE_END(); } while (0);
/* It's FreeRTOS related feature but it's not included in FreeRTOS design. */
#define configUSE_WAKELOCK_PMU 1
#define configUSE_WAKELOCK_PMU 1
#endif // #if (__IASMARM__ != 1)

View file

@ -2,7 +2,8 @@
#define _user_config_h_
#define SYS_VERSION "1.0.0"
#define SDK_VERSION "3.5.3"
//#define SDK_VERSION "3.5.3"
#include "sdk_ver.h"
#define USE_WEB 80 // включить в трансялцию порт Web, если =0 - по умолчанию выключен
#define WEBSOCKET_ENA 1 // включить WEBSOCKET

View file

@ -333,12 +333,12 @@ LOCAL void fATSP(int argc, char *argv[])
switch (argv[1][0]) {
case 'a': // acquire
{
pmu_acquire_wakelock(atoi(argv[2]));
acquire_wakelock(atoi(argv[2]));
break;
}
case 'r': // release
{
pmu_release_wakelock(atoi(argv[2]));
release_wakelock(atoi(argv[2]));
break;
}
};

View file

@ -27,13 +27,12 @@ void fATSP(int argc, char *argv[])
}
}
}
printf("WakeLock Status %d\n", get_wakelock_status());
printf("WakeLock Status %d\n", pmu_get_wakelock_status());
}
MON_RAM_TAB_SECTION COMMAND_TABLE console_commands_pwrs[] = {
{"ATSP", 0, fATSP, "=<a,r>,<wakelock_status:1|2|4|8>: Power"}
};

View file

@ -226,16 +226,22 @@ LOCAL void fATSF(int argc, char *argv[])
}
LOCAL void fATWP(int argc, char *argv[]) {
int x = 0;
if(argc > 1) {
pmu_release_wakelock(0xffff);
wifi_set_power_mode(1, 1);
wifi_set_lps_dtim(atoi(argv[1]));
x = atoi(argv[1]);
if(x == 0) {
acquire_wakelock(~WAKELOCK_WLAN);
release_wakelock(0xffff);
_wext_enable_powersave(0, 0, 0);
_wext_set_lps_dtim(0, 1);
} else {
release_wakelock(~WAKELOCK_WLAN);
_wext_enable_powersave(0, 1, 1);
_wext_set_lps_dtim(0, x);
}
}
else {
unsigned char x;
if(wifi_get_lps_dtim(&x) >= 0) {
printf("DTIM: %d\n", x);
}
printf("DTIM: %d\n", _wext_get_lps_dtim(0));
}
}
/* -------- WiFi Scan ------------------------------- */
@ -261,7 +267,6 @@ LOCAL void scan_result_handler(internal_scan_handler_t* ap_scan_result)
record->SSID.val[record->SSID.len] = '\0';
printf("%s\n", record->SSID.val);
}
}
} else {
printf("Scan networks: None!\n");
@ -308,7 +313,7 @@ MON_RAM_TAB_SECTION COMMAND_TABLE console_cmd_wifi_api[] = {
{"P2P_DISCCONNECT", 0, cmd_p2p_disconnect, ": p2p disconnect"},
{"P2P_CONNECT", 0, cmd_p2p_connect, ": p2p connect"},
#endif
{"ATWR", 0, fATWR, ": WIFI Connect, Disconnect"},
{"ATWR", 0, fATWR, "=[mode]: WIFI Mode: 0 - off, 1 - ST, 2 - AP, 3 - ST+AP"},
#if CONFIG_WLAN_CONNECT_CB
{"ATON", 0, fATON, ": Open connections"},
{"ATOFF", 0, fATOF, ": Close connections"},
@ -316,9 +321,9 @@ MON_RAM_TAB_SECTION COMMAND_TABLE console_cmd_wifi_api[] = {
{"ATWI", 0, fATWI, ": WiFi Info"},
#if CONFIG_DEBUG_LOG > 3
{"ATWT", 1, fATWT, "=<tx_power>: WiFi tx power: 0 - 100%, 1 - 75%, 2 - 50%, 3 - 25%, 4 - 12.5%"},
{"ATSF", 0, fATSF, ": Test TSF value"},
{"ATSF", 0, fATSF, ": Get TSF value"},
#endif
{"ATWP", 0, fATWP, ": WiFi power"},
{"ATWP", 0, fATWP, "=[dtim]: 0 - WiFi ipc/lpc off, 1..10 - on + dtim"},
{"ATSN", 0, fATSN, ": Scan networks"}
};

View file

@ -89,7 +89,7 @@ void user_init_thrd(void) {
webserver_init(syscfg.web_port);
if(syscfg.cfg.b.powersave_enable) {
pmu_release_wakelock(~WAKELOCK_WLAN);
release_wakelock(~WAKELOCK_WLAN);
}
// xTaskCreate(x_init_thrd, "wifi_init", 1024, NULL, tskIDLE_PRIORITY + 1 + PRIORITIE_OFFSET, NULL);

View file

@ -148,8 +148,8 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
else ifcmp("pinclr") syscfg.cfg.b.pin_clear_cfg_enable = (val)? 1 : 0;
else ifcmp("sleep") {
syscfg.cfg.b.powersave_enable = (val)? 1 : 0;
if(val) pmu_release_wakelock(~WAKELOCK_WLAN);
else pmu_acquire_wakelock(~WAKELOCK_WLAN);
if(val) release_wakelock(~WAKELOCK_WLAN);
else acquire_wakelock(~WAKELOCK_WLAN);
}
else ifcmp("debug") {
syscfg.cfg.b.debug_print_enable = val;