nimble WIP - writes kinda work now

This commit is contained in:
geeksville
2020-07-22 12:08:54 -07:00
parent 531f488fe8
commit b6a3deb341
8 changed files with 96 additions and 39 deletions
+9 -9
View File
@@ -5,9 +5,9 @@
#include "NodeDB.h"
#include "configuration.h"
#include "error.h"
#include "timing.h"
#include "main.h"
#include "target_specific.h"
#include "timing.h"
#ifndef NO_ESP32
#include "esp32/pm.h"
@@ -16,7 +16,7 @@
#include <driver/rtc_io.h>
#include <driver/uart.h>
#include "BluetoothUtil.h"
#include "nimble/BluetoothUtil.h"
esp_sleep_source_t wakeCause; // the reason we booted this time
#endif
@@ -294,18 +294,18 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
/**
* enable modem sleep mode as needed and available. Should lower our CPU current draw to an average of about 20mA.
*
*
* per https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/power_management.html
*
*
* supposedly according to https://github.com/espressif/arduino-esp32/issues/475 this is already done in arduino
*/
void enableModemSleep()
{
static esp_pm_config_esp32_t config; // filled with zeros because bss
static esp_pm_config_esp32_t config; // filled with zeros because bss
config.max_freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ;
config.min_freq_mhz = 20; // 10Mhz is minimum recommended
config.light_sleep_enable = false;
DEBUG_MSG("Sleep request result %x\n", esp_pm_configure(&config));
config.max_freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ;
config.min_freq_mhz = 20; // 10Mhz is minimum recommended
config.light_sleep_enable = false;
DEBUG_MSG("Sleep request result %x\n", esp_pm_configure(&config));
}
#endif