Friday 19 January 2018

How to Downgrade Particle System Firmware


Particle sometimes rushes to release their newest system firmware but your applications could stop working or some unexpected things happen for some reason.
So here is how to downgrade the system firmware.

Step 1: check the current system fw on the device
- connect your device to your computer with a USB cable
- press the SETUP button for 3 seconds to enter setup mode.
- using a serial monitor such as PuTTY (Windows) or screen (linux/OSX), to connect to the device
press 'v' - this prints the "system version, e.g. 0.6.3".

I'm using Linux so my command is:
                                screen /dev/ttyACM0

Step 2: download the target system fw
Say I want go back to 0.6.3, I can down load the system-part1 and part2 .bin file from this link.
https://github.com/particle-iot/firmware/releases/tag/v0.6.3

Step 3: flashing
particle flash YOUR_DEVICE_NAME system-part1-0.6.3-p1.bin particle flash YOUR_DEVICE_NAME system-part2-0.6.3-p1.bin particle flash YOUR_DEVICE_NAME tinker (NOT optional)

NOTE THAT THE LAST STEP, FLASHING TINKER, IS NOT OPTIONAL.

I think the device might have to handshake with the particle cloud at some point. If you don't do this, you can check the system fw with step 1, and you might see it's still showing you the old version number.


ref:
https://community.particle.io/t/determining-the-version-of-system-firmware-on-a-photon-p1/13324
https://github.com/particle-iot/firmware/releases/tag/v0.6.3
https://community.particle.io/t/particle-firmware-updates-thread/14378/25

Sunday 7 January 2018

platformio ImportError: cannot import name LockFile


sudo apt-get purge python-lockfile
sudo pip install -U platformio


ref:
https://github.com/platformio/platformio-atom-ide/issues/48  *****
https://github.com/platformio/platformio-core/issues/360
https://github.com/platformio/platformio-core/issues/252

Discard unstaged changes in Git

There could be times that you just temporarily tried something, or showing other people something and you have some garbage code.

When using Git, it is common to make changes that you want to remove entirely before the staging phase. For example, after working on a few files, you realize that you want to revert the changes made to one specific file. To discard the changes before staging and committing, use the $git checkout command.

To unstage one file :
$ git checkout <path-to-file>
Remember to replace <path-to-file> with the actual file name.

To unstage all files:
$ git checkout -- .
ref:
https://forum.freecodecamp.org/t/discard-unstaged-changes-in-git/13214