1 (edited by Guillaume 2017-01-13 14:24:50)

Topic: Struct limit of 256 bytes?

Hello, I have this code

uint8_t RemoteXY_CONF[] =
   { 13,280,113,0,6,0,2,4,16,93
  ,2,5,53,56,2,5,90,0,7,36
  ,1,57,87,5,1,94,50,5,0,11
  ,1,1,89,57,10,5,52,94,10,5
  ,0,83,69,78,68,0,67,0,2,2
  ,91,3,2,2,55,5,2,56,67,0
  ,2,5,91,3,2,7,55,5,2,56
  ,67,0,2,8,91,3,2,12,55,5
  ,2,56,67,0,2,11,91,3,2,17
  ,55,5,2,56,67,0,2,14,91,3
  ,2,22,55,5,2,56,130,0,1,1
  ,98,55,1,1,61,92,6 };
  
/* this structure defines all the variables of your control interface */
struct {

    /* input variable */
  int8_t slider_1; /* =0..100 slider position */
  char edit_1[11];  /* string UTF8 end zero  */
  uint8_t button_1; /* =1 if button pressed, else =0 */

    /* output variable */
  char text_1[56];  /* string UTF8 end zero */
  char text_2[56];  /* string UTF8 end zero */
  char text_3[56];  /* string UTF8 end zero */
  char text_4[56];  /* string UTF8 end zero */
  char text_5[56];  /* string UTF8 end zero */

    /* other variable */
  uint8_t connect_flag;  /* =1 if wire connected, else =0 */

} RemoteXY;

It doesn't works, but if I change size of texts to like 32, then it will work.

Looking in the code I can see #define REMOTEXY_SEND_BUFFER_LENGTH 256 but increasing it (tried 2560) doesn't solve the problem.

I would like a way to increase this limit, or better yet, remove limit if possible smile

2

Re: Struct limit of 256 bytes?

Sorry I posted wrong code, I edited and updated code, but same problem.

3

Re: Struct limit of 256 bytes?

Thanks Guillaume.
We will test this code and try to fix problem.
I will tell about result.

4

Re: Struct limit of 256 bytes?

The problem can also be reproduced if you just put a Text of size of 252 or more

/* RemoteXY configurate  */
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 0,251,11,0,6,5,0,67,4,1
  ,1,20,5,2,252 };
  
/* this structure defines all the variables of your control interface */
struct {

    /* output variable */
  char text_1[252];  /* string UTF8 end zero */

    /* other variable */
  uint8_t connect_flag;  /* =1 if wire connected, else =0 */

} RemoteXY;
#pragma pack(pop) 

It says "Device not reply. Receive time out error"

5

Re: Struct limit of 256 bytes?

Tell me, how do you set the length of text_1 to 252? Into editor?
In your sketch the structure RemoteXY does not compatible with array RemoteXY_CONF.

6 (edited by Guillaume 2017-01-14 19:41:00)

Re: Struct limit of 256 bytes?

Hello and sorry again, yes I modified manually...


But the problem is now obvious, I just noticed...

The array is of type uint8_t, but in the code in the first post you can see a value 280, and in the following example, 402. Those values does not fit in a uint8_t.

#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 0,402,19,0,6,5,0,67,4,2
  ,2,95,5,2,201,67,4,2,8,95
  ,5,2,201 };
  
// this structure defines all the variables of your control interface 
struct {

    // output variable
  char text_1[201];  // string UTF8 end zero
  char text_2[201];  // string UTF8 end zero

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0

} RemoteXY;
#pragma pack(pop) 

7

Re: Struct limit of 256 bytes?

Yes, I see.
It is limitation. Length of all output variables not more than 255. Length of all input variables not more than 255.
We need to modify the library and code generator to fix this bug.

8

Re: Struct limit of 256 bytes?

Yes, shouldn't be too hard to fix smile

9 (edited by Guillaume 2017-02-26 15:21:31)

Re: Struct limit of 256 bytes?

Any idea when/if this will be fixed? These limits are really not enough hmm

The quick fix would be to increase that limit by using 2 bytes (or more) in the conf array instead of 1, then you read it and use it as a 16 (or more) bits number.

10

Re: Struct limit of 256 bytes?

yes, we have solution how it fix. It solution have necessary to update the library all users, old library will not be work. And we plan add something features at the same time.

11

Re: Struct limit of 256 bytes?

Ok, thanks wink