I've fixed the "pwr-button failure after reset" (-without callback) issue.
Class constructors are called before setup(). I've used this feature to save and reset SNVS_LPSR.
(did not want to mess the startup hooks)
@Tim, can you test?
see latest version on github
Yes, Seems to work right. Good Fix and very 'classy' : __class_reset_snvs_psr
>> Only way it causes trouble is: after shutdown with 'arm_reset()', the Program is held/touched on Power On and new 'non POWER' sketch is uploaded - not Normal. The restart is not cleared and then funny things happen - had to hold power 5 seconds then press again and next upload took a Button press. Something like that is what started that other thread with WMXZ :
issue-to-reporogram-T4-0 - which is what led to this
> TESTING :: With new github lib
- ran power.ino sketch
- it said : Restart after power down { expected }
- pressed button and it shutdown fast : Callback called - Switching off now.
- Pressed button and it woke : Restart after power down
- Loaded another sketch and Power Off normal 5 seconds
- Power On - back to same sketch
- Uploaded power.ino : Restart after power down
- TyComm Reset power.ino shows : First power on
> Added this to power.ino loop() : if ( Serial.available() ) arm_reset();
- upload other sketch
- Power Off : It stayed OFF
- Power On : sketch came up running
- Uploaded power.ino : Restart after power down
All seems good and right and usable. Cool using FLASHRAM to keep code on FLASH.
Can you make this all go away with #ifdef so if included and same sketch runs on on a T_3.x::
Compile give: 'T:\tCode\libraries\T4_PowerButton\T4_PowerButton.cpp:29:19: fatal error: imxrt.h: No such file or directory' and then all the functions will be MAD if note defined to 'go away' with macros or a fake class for unsupported parts.
>> I see : set_arm_power_button_callback(0); // Disable fast Power Off
- does disable the FAST SHUTDOWN - maybe add that as a comment in the sample?
Nice with the add of: arm_enable_nvram
- having easy to use state storage for reset seems relevant
> Can you add a sample showing use addressing into those 128 bits?
- like my sample indexing 4 DWORDS?