Skip to content

ESP32 specific bug: GetWordValue returns wrong value #3

Description

@refob

Bug_ESP32.zip
Bug_ESP32_fixed.zip

I found an issue with GetWordValue when I ran the provide example on an ESP32 cpu:
GetWordValue returns 288 for the input "G0X120". For "G00X120" I get the correct value of 0.

Running the same code on an Arduino I always got the correct value. I fixed this by using:

if ((line[pointer + 1] == '0') && (line[pointer + 2] == 'X'))
  return 0.0;
else
  return (double)strtod(&line[pointer + 1], NULL);

instead of:

return (double)strtod(&line[pointer + 1], NULL);

Please run the code in Bug_ESP32.zip to see this output on an ESP32:

Ready

Command Line: G0X120Z-10F30
Comment(s):
Process G code: 288

Command Line: G0X1
Comment(s):
Process G code: 1

Command Line: G0X12
Comment(s):
Process G code: 18

Command Line: G0X120
Comment(s):
Process G code: 288

Command Line: G00X120
Comment(s):
Process G code: 0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions