The lookup table doesn't seem to work with long (32 bit) ints.
Has a lookup table (32 bit unsigned) - and two values stored GetInt(0) (returns a ULONG) returns 64 which is the LSB of the first item stored. It obviously just returns a byte - but the docs imply if should return an int.
Martin
Lookup table 32 bit ints
Moderator: Benj
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Lookup table 32 bit ints
Thanks for the spot. Yes, looks like a bug in the Arduino/AVR implementation
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Lookup table 32 bit ints
Hi Martin,
Please try the attached, to go into C:\ProgramData\MatrixTSL\FlowcodeV8\Components
Thanks
Leigh
Please try the attached, to go into C:\ProgramData\MatrixTSL\FlowcodeV8\Components
Thanks
Leigh
- Attachments
-
- lut.fcpx
- (46.56 KiB) Downloaded 124 times
-
- Valued Contributor
- Posts: 1189
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 439 times
- Contact:
Re: Lookup table 32 bit ints
Thanks - seems to work AOK.. I've tried 16/32 bit signed and unsigned and float and all seems good..
The only gotcha I can find - is because GetInt returns an unsigned long - retrieving a signed 16 bit value to a 32 bit signed variable the result doesn't get sign extended. (so -2345 will give 63191 as a result.) - so have to use the right 'size' variable for the result.
Martin
The only gotcha I can find - is because GetInt returns an unsigned long - retrieving a signed 16 bit value to a 32 bit signed variable the result doesn't get sign extended. (so -2345 will give 63191 as a result.) - so have to use the right 'size' variable for the result.
Martin