Skip to content

Instantly share code, notes, and snippets.

@t413
t413 / blackboxPull.sh
Created March 8, 2022 19:47
Enables Betaflight blackbox filesystem-mode, archives files, then erases blackbox (for MacOS)
### enables betaflight blackbox filesystem-mode, archives files, then erases blackbox (after manual power cycle)
# usage blackboxPull /dev/tty.my.serial [optional folder to output, default is pwd/logs]
function blackboxPull() {
port="${1}";
folder="${2:-logs}";
[ -f "$port" ] || { echo "port \"$port\" doesn't exist!"; return 1; }
{ echo "#"; sleep 0.5; echo msc; } >> "$port"; ##enables cli then sends command for flash download
sleep 4;
echo "copying files to ${folder}";
@Flexi23
Flexi23 / gist:1713774
Created January 31, 2012 23:27
GLSL 2D vector buffer in a texture with a custom floating point precision
/*
These are the helper functions to store and to restore a 2D vector with a custom 16 floating point precision in a texture.
The 16 bit are used as follows: 1 bit is for the sign, 4 bits are used for the exponent, the remaining 11 bit are for the mantissa.
The exponent bias is asymmetric so that the maximum representable number is 2047 (and bigger numbers will be cut)
the accuracy from 1024 - 2047 is one integer
512-1023 it's 1/2 int
256-511 it's 1/4 int and so forth...
between 0 and 1/16 the accuracy is the highest with 1/2048 (which makes 1/32768 the minimum representable number)