sbyte (int8_t) type in DSF for g-codes with MinorNumber
-
@chrishamm Is there a reason why DSF uses an sbyte (int8_t) for MinorNumber when parsing a g-code, and then check that value is greater than 0 in the Parser class ?
if (sbyte.TryParse(args[1], out sbyte minorNumber) && minorNumber >= 0) { result.MinorNumber = minorNumber; } else { throw new CodeParserException($"Failed to parse minor {char.ToUpperInvariant((char)result.Type)}-code number ({args[1]})", result); }
The type used in RepRap looks like an integer
struct CodeHeader { uint8_t channel; CodeFlags flags; uint8_t numParameters; char letter; int32_t majorCode; int32_t minorCode; uint32_t filePosition; int32_t lineNumber; };
Would it be possible to use the same data type or just a more redundant integer type ?
-
@fragrama17 I'm quite sure the minor number parameter was an
sbyte
in early DSF versions. I'll change the parser accordingly. Thanks for pointing this out.Negative command portions should not be supported so I'll leave that exception there. RRF may be changed to throw an exception, too.