-
Notifications
You must be signed in to change notification settings - Fork 1
Added latest lpwFuncs changes #1
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
base: master
Are you sure you want to change the base?
Conversation
…to go into dormant
… change all to pinMode/digitalWrite
… pins' (see also: lib/power/sleep.{c/h})
…sing global flag = goingDormant this flag can be used to signal other processes that dormant should be prepared for
src: gpio.h: function prototype of clearLeds(), this is to save more juice src: gpio.cpp: implement clearLeds() src: lpwfuncs.cpp: add soft startup function
|
I'd like you to review this @ChrisVeigl Lg, Jimmi :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi! thanks for the pull request!
I have some questions regarding what is really necessary / eventually missing ...
BTW: thanks for support for multiple wakeup pins! - I integrated that already "manually" ..
| Serial.end(); | ||
| displayMessage((char*)"ByeBye"); | ||
| delay(2000); // time for the user to read the message | ||
| disable3V3(); // shut down peripherals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this essential ??
it shuts down the power supply external loads ...
where is this in your code - or why was it removed?
| dormantUntilInterrupt(input_map, NUMBER_OF_PHYSICAL_BUTTONS); // enter sleepMode, use input_map pins to wakeup! | ||
| // <-- now sleeping! | ||
|
|
||
| cyw43_arch_init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if / why this is needed ... shouldn't the cyw43 come up normally after the watchdog reset?
| digitalWrite(pin, LOW); | ||
| pinMode(pin, INPUT); | ||
| digitalWrite(pin, LOW); | ||
| delay(5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there an important difference? - why not keep the low-level functions?
is the delay really needed?
why are these specific pins skipped?
| memset(device_list,0,8); | ||
|
|
||
| while(supported_devices[devicenr] != 0x00) { //test until address is 0x00 | ||
| while(supported_devices[devicenr] != 0x00 && !goingDormant) { //test until address is 0x00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the goingDormant flag needed? did the I2C access interfere with sleep mode activation? should we add a function instead to activate / suspend I2C access?
| } | ||
| if (Wire1.available()) { | ||
| Wire1.flush(); delay(10); Wire1.endTransmission(); delay(10); Wire1.end(); delay(100); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe put that in a dedicated function, and into a module than handles I2C init / testing / deactivation?
Did you find that shutting down Wire and Wire1 significantly reduces power consumption during sleep?
|
|
||
| void initDormant() { | ||
| goingDormant = true; | ||
| delay(2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove this delay?
(initially we had a 2 sec delay to be able to read the "byeBye"-message on the display.
I think it makes more sense to signal the sleep mode using a tone sequence (maybe the startup tones reversed?)
NOTE:
The sub 700 mA were reached having the clearLeds() (see TODO commit) function. I am not entirely sure whether I should touch more files on just one brunch or not. Best keep it simple and "überschaubar für's Erste".
NOTE:
These were some quick additions of what was available on my other fork of the old FABI repo as of commit where firmware was found in that very repo as opposed to the new system (hardware and firmware have their respective repos).
Take it with a grain of salt.