Skip to content

Improve cellular client reconnection #302

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

Merged
merged 13 commits into from
Apr 11, 2025
Merged

Conversation

samuelbles07
Copy link
Collaborator

Changes

  1. Power cycle cellular module control directly on main, if airgradient client not ready for more than 1 hour
  2. If in 2 hour airgradient client still not ready, then esp restart. Has redundant check in both main and networking tasks.
  3. Transmit measures only if measurement cycle queue size is divisible by 3

@samuelbles07 samuelbles07 requested a review from nick-4711 April 10, 2025 03:18
bool resetModule = true;
if ((millis() - startTimeClientNotReady) > (60 * 60000)) {
Serial.println("Power cycling module");
cell->powerOff();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cell -> cellularCard

Copy link
Collaborator Author

@samuelbles07 samuelbles07 Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it to cellularModule. Don't really agree to say cellular card, since its actually a cellular module. Or do you have an opinion for this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me the module is the code and the card the hardware. Here we have a problem with the hardware (or network), not with the code? Or does cellularModule refer to the A7672G chip on the CE card? Then there could still be issues like e.g. the A7672G not being able to communicate with the SIM card, so cellularModule referring to the A7672G would be misleading in such a case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, we have a different definition then. I guess the convention in c or c++ is never saying module, instead of library. But even though if it is, we never add module when declaring variable or library (eg. agClient not agClientLibrary).

Or does cellularModule refer to the A7672G chip on the CE card

yes

I'm not agree with CE card because the chip is not actually communicate with the sim card, but the module. I think we can say sim card as the part of the whole module, since its actually can be a common sim card or e-sim. What you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, yes, library for the software makes sense. But the hardware we called CE-Card from the very start, not CE-module.

@nick-4711
Copy link
Collaborator

In the lib

"Failed reinitialized cellular module
->
"Failed to reinitialize the cellular module

@nick-4711
Copy link
Collaborator

Propose to also add a sample log where we see the two mechanisms kick in to the PR

@samuelbles07
Copy link
Collaborator Author

Propose to also add a sample log where we see the two mechanisms kick in to the PR

Attached the logs, module unplugged around 17:28

Point of interest:

  1. 16:28:28 start detect client not ready
  2. 17:28:28 start power cycle module in 1 hour mark
  3. 18:26:53 system restart

2hours.log

/**
* If in 2 hours still not ready, then restart esp
*/
void checkCellularClientNotReady() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't like the name, we can't guess what it does.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to restartIfCeClientIssueOverTwoHours

while (i != 0) {
if (ag->isOne()) {
String tmp = "Rebooting in " + String(i);
oledDisplay.setText("CE error", "since 1h", tmp.c_str());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it say 2h

Rename checkCellularClientNotReady to restartIfCeClientIssueOverTwoHours
@samuelbles07 samuelbles07 requested a review from nick-4711 April 11, 2025 07:19
Serial.println("Cellular client not ready, ensuring connection...");
// Start time if value still default
if (agCeClientProblemDetectedTime == 0) {
agCeClientProblemDetectedTime = MICROS_TO_MINUTES();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, I think it should be named
minutes()
or so (similar to millis()), we do not pass anything in

@samuelbles07 samuelbles07 merged commit b70ee75 into develop Apr 11, 2025
20 checks passed
@samuelbles07 samuelbles07 deleted the improve-ce-reconnection branch April 11, 2025 08:49
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.

2 participants