The diodes are a simple hack.
The proper way would be a hot swap controller, e.g. LTC4227 (check the datasheet for allowed voltages and and current consumption). It senses the input voltages of multiples sources and controls a transistor to connect the source with the highest input voltage to the output.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The diodes are a simple hack.
The proper way would be a hot swap controller, e.g. LTC4227 (check the datasheet for allowed voltages and and current consumption). It senses the input voltages of multiples sources and controls a transistor to connect the source with the highest input voltage to the output.