Thank you for finding a reproducible fail case for this. I was able to reproduce this and fix it when the GPS is powered down (D6 set HIGH before sleep). I suspect this change will also fix the randomly not being able to wake up from sleep even when the GPS is on.
Reinitializing the LIS3DH prior to calibrating the filter seems to solve the problem. Basically this, just before accel.calibrateFilter(2000).
LIS3DHConfig config;
config.setLowPowerWakeMode(16);
accel.setup(config);
When unable to wake up from sleep, it’s definitely the LIS3DH not generating the WKP pulse, not an issue with the Electron not waking up. I put a logic analyzer on it and WKP doesn’t change.
There’s a new version of AssetTrackerRK 0.1.5, with this change. It also has a fix for isValid not actually being valid.