How to pass values larger than a byte from GCV to GPC?
2 posts
• Page 1 of 1
How to pass values larger than a byte from GCV to GPC?
I am currently passing two values from my GCV script to my GPC script. I was easily setting them for example like:
self.gcvdata[0] = 1
self.gcvdata[1] = 100
which worked fine but now I need the second value at index 1 to be anywhere from 500 to 5000 (a byte maxes out at 255). I do not have much experience with byte arrays so can someone help me with passing the larger value? Thanks!
self.gcvdata[0] = 1
self.gcvdata[1] = 100
which worked fine but now I need the second value at index 1 to be anywhere from 500 to 5000 (a byte maxes out at 255). I do not have much experience with byte arrays so can someone help me with passing the larger value? Thanks!
-
GarrisonXV - Sergeant
- Posts: 9
- Joined: Wed Nov 11, 2020 1:03 am
Re: How to pass values larger than a byte from GCV to GPC?
Example of passing int16 value.
On Phyton script:
On Titan Two script:
And for fix32 value.
On Phyton script:
On Titan Two script:
On Phyton script:
- Code: Select all
gcvdata = bytearray()
gcvdata.extend(int(value).to_bytes(2, byteorder='big', signed=True))
On Titan Two script:
- Code: Select all
int16 value;
gcv_read(0, &value);
And for fix32 value.
On Phyton script:
- Code: Select all
gcvdata = bytearray()
gcvdata.extend(int(value*0x10000).to_bytes(4, byteorder='big', signed=True))
On Titan Two script:
- Code: Select all
fix32 value;
gcv_read(0, &value);
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
2 posts
• Page 1 of 1
Return to Gtuner Computer Vision
Who is online
Users browsing this forum: No registered users and 140 guests