Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try-fix: tbeam router goes sporadically into DS #2444

Merged
merged 2 commits into from
Apr 22, 2023

Conversation

mverch67
Copy link
Collaborator

It has been observed that a node which is configured with device.role ROUTER is sometimes dead after a while.

It is suspected that the dead node is in deep sleep which normally happens only when the battery percentage falls below 10%. However it may happen also in case the battery readings deliver a wrong too low (or zero) value. For NRF52 the code requires ten subsequent measurements below the 10% threshold. For ESP32 only one(!) measurement below the threshold causes immediately a transition into deep sleep:

Power.cpp
// If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 3 low readings in a row
// Supect fluctuating voltage on the RAK4631 to force it to deep sleep even if battery is at 85% after only a few days
#ifdef ARCH_NRF52
        if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
            if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) {
                low_voltage_counter++;
                LOG_DEBUG("Warning RAK4631 Low voltage counter: %d/10\n", low_voltage_counter);
                if (low_voltage_counter > 10) {
                    // We can't trigger deep sleep on NRF52, it's freezing the board
                    // powerFSM.trigger(EVENT_LOW_BATTERY);
                    LOG_DEBUG("Low voltage detected, but not triggering deep sleep\n");
                }
            } else {
                low_voltage_counter = 0;
            }
        }
#else
        // If we have a battery at all and it is less than 10% full, force deep sleep
        if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB() && batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS)
            powerFSM.trigger(EVENT_LOW_BATTERY);
#endif

This try-fix adopts the algorithm for battery low detection also for other platforms (ESP32). Hopefully, this will make the TBeam router mode usable.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 21, 2023

🤖 Pull request artifacts

file commit
pr2444-firmware-2.1.10.3a5da73.zip 3a5da73

thebentern added a commit to meshtastic/artifacts that referenced this pull request Apr 21, 2023
thebentern added a commit to meshtastic/artifacts that referenced this pull request Apr 21, 2023
@caveman99 caveman99 merged commit 6e26f95 into meshtastic:master Apr 22, 2023
@PhilipLykov
Copy link

The fix didn't resolve the issue. My T-Beam v1.1 still hangs with ROUTER role. It works fine with ROUTER_CLIENT role.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants