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

Multiplexer Deactivates Itself After Sleep #76

Closed
prototypicalpro opened this issue Feb 20, 2020 · 2 comments
Closed

Multiplexer Deactivates Itself After Sleep #76

prototypicalpro opened this issue Feb 20, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@prototypicalpro
Copy link
Member

prototypicalpro commented Feb 20, 2020

Describe the bug
When using the I2C multiplexer and LoomManager::sleep, the multiplexer will mark itself deactivated by setting Loom_Module::active to false during Loom_Multiplexer::power_up:

Loom/src/Multiplexer.cpp

Lines 402 to 410 in fc36a8d

void Loom_Multiplexer::power_up() {
// Begin I2C
Wire.begin();
Wire.beginTransmission(this->i2c_address);
if(Wire.endTransmission() ) { //< Test on this address
//< Test Failed
LPrintln("Multiplexer not found on specified port. Checking alternate addresses.");
this->active = false;
causing subsequent measure calls to ignore the module:

Loom/src/Manager.cpp

Lines 197 to 200 in fc36a8d

void LoomManager::measure()
{
for (auto module : modules) {
if ( !module->get_active() ) continue;

The module will then remain deactivated even after calling LoomManager::power_up after the board has fully powered on.

While it makes sense to me that Loom_Multiplexer::power_up would deactivate the module because it cannot communicate with the multiplexer before the Hypnos is powered on, it is not clear to me why subsequent calls to Loom_Multiplexer::power_up do not reactivate the module. More investigation is needed.

Hardware in Use
Tested on the SitkaNet setup, but should reproduce on any Feather/Hypnos/Multiplexer project (so long as the multiplexer power controlled by the Hypnos).

To Reproduce
Any project using Loom::sleep with the multiplexer should be able to reproduce this issue. Simply load any sketch using sleep and the multiplexer, allow the board to sleep/wakeup once, and the board will no longer measure any multiplexer sensors.

@prototypicalpro prototypicalpro added the bug Something isn't working label Feb 20, 2020
maxchu765 added a commit that referenced this issue Feb 20, 2020
@prototypicalpro
Copy link
Member Author

prototypicalpro commented Feb 21, 2020

15999f7 temporarily fixes the issue.

@prototypicalpro
Copy link
Member Author

prototypicalpro commented Feb 27, 2020

The solution proposed to this is to move all automatic re-initialization code in LoomManager::sleep() to the sketch. This will also resolve issues with the ordering of DS3231 power up and toggling of hypnos pins. More documentation on proper powering up routines will be needed after this change (#79).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants