Skip to content

Commit

Permalink
experimental bug fix memory threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberman54 committed May 11, 2018
1 parent 06e6845 commit 14b0019
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/blecsan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -177,8 +176,6 @@ static void gap_callback_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_pa
*/

}

}
break;

default:
Expand Down
1 change: 1 addition & 0 deletions src/lorawan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14b0019

Please sign in to comment.