experimental bug fix memory threshold

This commit is contained in:
cyberman54 2018-05-11 19:07:48 +02:00
parent 06e68459c8
commit 14b00196de
3 changed files with 7 additions and 6 deletions

View File

@ -99,17 +99,16 @@ static void gap_callback_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_pa
switch (event)
{
case ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT:
{ // restart scan
// restart scan
status = esp_ble_gap_start_scanning(cfg.blescantime);
if (status != ESP_OK)
{
ESP_LOGE(TAG, "esp_ble_gap_start_scanning: rc=%d", status);
}
}
break;
case ESP_GAP_BLE_SCAN_RESULT_EVT:
{
// evaluate scan results
if ( p->scan_rst.search_evt == ESP_GAP_SEARCH_INQ_CMPL_EVT) // Inquiry complete, scan is done
{ // restart scan
status = esp_ble_gap_start_scanning (cfg.blescantime);
@ -177,8 +176,6 @@ static void gap_callback_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_pa
*/
}
}
break;
default:

View File

@ -136,6 +136,7 @@ void do_send(osjob_t* j){
if (cfg.countermode != 1) {
reset_counters(); // clear macs container and reset all counters
reset_salt(); // get new salt for salting hashes
ESP_LOGI(TAG, "Counter cleared (countermode = %d)", cfg.countermode);
}
}

View File

@ -627,7 +627,10 @@ void loop() {
#endif
// check free memory
if (ESP.getFreeHeap() <= MEM_LOW) {
//if (ESP.getFreeHeap() <= MEM_LOW) {
if (esp_get_minimum_free_heap_size() <= MEM_LOW) {
// ESP_LOGI(TAG, "Counter cleared (memory low = %d Bytes)", ESP.getFreeHeap());
ESP_LOGI(TAG, "Counter cleared (memory low water mark = %d Bytes)", esp_get_minimum_free_heap_size());
do_send(&sendjob); // send count
reset_counters(); // clear macs container and reset all counters
reset_salt(); // get new salt for salting hashes