Closed i-make-robots closed 7 years ago
possible fix in 42c0b5d65d51f3352612709255cd09155de4eb32
just ptr++; worked for me.
You never know if spaces will be in between or not (as they are not mandatory).
See makelangelo-firmware for updated version.
On Sep 29, 2016, at 3:19 AM, Miguel Sanchez notifications@github.com wrote:
just ptr++; worked for me.
Trouble is strchr returns null if space is not found.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
updated all versions to match makelangelo-firmware, but now github desktop is broken in windows 10.
float parsenumber(char code,float val) { char _ptr=buffer; while(ptr && *ptr && ptr<buffer+sofar) { if(_ptr==code) { return atof(ptr+1); } ptr=strchr(ptr,' ')+1; } return val; }
if strchr() does not find ' ' it returns null (0) and ptr becomes 1. while(ptr) would not stop the loop.
while(ptr... should be while(ptr>1...