G30 Design Project Continued

How do I properly use this method?

public static bool WriteEntry(
	string name,
	byte[] buffer
)

How do I represent an array in the buffer? Do I have to write each byte one at a time? No idea how this would look.

To properly use the configuration class, only write the data once.

Check the GHI Utility namespace for a helper class to insert and extract data to /from a byte array, as required by the configuration class API.

1 Like

is this what you are referring to?

public static void InsertInt32(
	byte[] buffer,
	int offset,
	int value
)

For the value and offset parts, do I create a For loop that adds each number one at a time? like first value gets zero offset, second value is offset 1…and so on till the array is fully converted?

This seams a bit tricky to implement as there isn’t much room for mistakes.

With WriteEntry() there is no way to corrupt the memory, correct? Only Write() can corrupt it?

Am I setting this up correctly?

for (int i=0; i <=Tabs[];i++)
{
InsertInt32(
calBuffer,
i,
Tabs[i]);
}

WriteEntry("Calibration",calBuffer);

ReadEntry("Calibration");

The best way to answer your question is to create a new program and experiment. You will learn a lot that way.

Your approach is correct, but there are some issues in your code.

I already created a program to do so, I just want to be sure I am doing it correctly before I run it so I do not corrupt the Configuration Space as somebody mentioned they did using Write() instead of WriteEntry().

What is the issue with my code.

I can’t figure out how to use InsertInt32() correctly, It keeps inserting 2 values at once into my buffer…is there any more clear documentation on this method? The GHI docs just say what the inputs are.

Am I using the offset part wrong??

Yes.

you have to count the bytes inserted. Int32 is four bytes.

0 4 8 …

Thank you I was so confused why it was putting multiple numbers in. I studied mechanical engineering - all coding I know is self taught so forgive my silly questions.

Ok I got the conversion working and successfully wrote a named entry to the configuration area but when calling ReadEntry back on the same entry it gives me an exception saying the offset must be the same length as returned by GetEntrySize();

GetEntrySize() returns 132 bytes which is the same size as the buffer I am have in ReadEntry. This makes no sense, Is the ReadEntry() method broken?

Byte[] calRecall = new Byte[GHI.Processor.Configuration.GetEntrySize("Calibration");
GHI.Processor.Configuration.ReadEntry("Calibration",calRecall);

I clearly make the buffer the same size as the entry but it tells me the offset is wrong?

post the code snippet that you are using to test.

I am now in the wilderness of Alaska, and will be out of LTE coverage for most of the next week. maybe someone else can help you.

may the moose not be with you…

just saw the code you posted. Look at your code carefully. the problem is clearly obvious.

1 Like

I fixed the quotation that was out of place, that was not the issue - just from me typing up on here. I have a friend that is living in Alaska doing the decal wrapping on the boats for Whale Wars haha