This commit is contained in:
pvvx 2017-05-29 01:43:16 +03:00
parent 437e8beb33
commit 25e75da8fd
9 changed files with 70 additions and 12 deletions

View file

@ -5,6 +5,7 @@
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "freertos_pmu.h"
#include "at_cmd/log_service.h"
#include "at_cmd/atcmd_wifi.h"
#include <lwip_netconf.h>
@ -332,17 +333,17 @@ LOCAL void fATSP(int argc, char *argv[])
switch (argv[1][0]) {
case 'a': // acquire
{
acquire_wakelock(atoi(argv[2]));
pmu_acquire_wakelock(atoi(argv[2]));
break;
}
case 'r': // release
{
release_wakelock(atoi(argv[2]));
pmu_release_wakelock(atoi(argv[2]));
break;
}
};
};
printf("WakeLock Status %d\n", get_wakelock_status());
printf("WakeLock Status %d\n", pmu_get_wakelock_status());
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------

View file

@ -12,6 +12,7 @@
#include "wifi_conf.h"
#include "rtl8195a/rtl_libc.h"
#include "hal_platform.h"
#include "freertos_pmu.h"
#include "section_config.h"
#include "hal_diag.h"
@ -226,7 +227,7 @@ LOCAL void fATSF(int argc, char *argv[])
LOCAL void fATWP(int argc, char *argv[]) {
if(argc > 1) {
release_wakelock(0xffff);
pmu_release_wakelock(0xffff);
wifi_set_power_mode(1, 1);
wifi_set_lps_dtim(atoi(argv[1]));
}

View file

@ -33,7 +33,7 @@ INA219DRV ina219drv = {
INA219_CONFIG_BVOLTAGERANGE_16V | // INA219_CONFIG_BVOLTAGERANGE_32V
INA219_CONFIG_GAIN_8_320MV | // INA219_CONFIG_GAIN_1_40MV |
INA219_CONFIG_BADCRES_12BIT |
INA219_CONFIG_SADCRES_12BIT_2S_1060US | // INA219_CONFIG_SADCRES_12BIT_128S_69MS |
INA219_CONFIG_SADCRES_12BIT_1S_532US | //INA219_CONFIG_SADCRES_12BIT_2S_1060US | // INA219_CONFIG_SADCRES_12BIT_1S_532US | //
INA219_CONFIG_MODE_SANDBVOLT_CONTINUOUS,
.calibration = 8192, // при шунте 0.1 Ом
.buf_idx = 709, // циклический буфер на 710 замеров (по 4 байт -> sizeof(INA219DATA))
@ -227,7 +227,7 @@ int ina219_ws(TCP_SERV_CONN *ts_conn, char cmd)
};
_i2c_init(&p->i2c);
gtimer_init(&p->timer, INA219_TIMER);
gtimer_start_periodical(&p->timer, 1000, (void*)ina_tick_handler, (uint32_t)&ina219drv);
gtimer_start_periodical(&p->timer, 532*2, (void*)ina_tick_handler, (uint32_t)&ina219drv);
p->init = 1;
// return 0;
}
@ -276,7 +276,7 @@ void ina219_init(void)
// Tick every 0.000532 sec (N*532 μs)
// uint32 tus = (1 << ((p->config >> 3) & 7));
// tus *= 532;
gtimer_start_periodical(&p->timer, 1000, (void*)ina_tick_handler, (uint32_t)&ina219drv);
gtimer_start_periodical(&p->timer, 532*2, (void*)ina_tick_handler, (uint32_t)&ina219drv);
rtl_printf("INA219 Timer Period = %u us\n", p->timer.hal_gtimer_adp.TimerLoadValueUs);
p->init = 1;
}

View file

@ -89,7 +89,7 @@ void user_init_thrd(void) {
webserver_init(syscfg.web_port);
if(syscfg.cfg.b.powersave_enable) {
release_wakelock(~WAKELOCK_WLAN);
pmu_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) release_wakelock(~WAKELOCK_WLAN);
else acquire_wakelock(~WAKELOCK_WLAN);
if(val) pmu_release_wakelock(~WAKELOCK_WLAN);
else pmu_acquire_wakelock(~WAKELOCK_WLAN);
}
else ifcmp("debug") {
syscfg.cfg.b.debug_print_enable = val;