You are reading a single comment by @d0773d and its replies. Click here to read the full conversation.
  • uint8_t in[128]  = { 0x7B, 0x22, 0x50, 0x48, 0x22, 0x3A, 0x5B, 0x22,
                                          0x52, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x22, 0x2C, 
                                          0x35, 0x2E, 0x35, 0x5D, 0x2C, 0x22, 0x45, 0x43, 
                                          0x22, 0x3A, 0x5B, 0x22, 0x52, 0x65, 0x73, 0x75,
                                          0x6C, 0x74, 0x22, 0x2C, 0x37, 0x30, 0x30, 0x5D,
                                          0x2C, 0x22, 0x52, 0x65, 0x73, 0x54, 0x65, 0x6D,
                                          0x70, 0x22, 0x3A, 0x5B, 0x22, 0x52, 0x65, 0x73,
                                          0x75, 0x6C, 0x74, 0x22, 0x2C, 0x31, 0x33, 0x37,
                                          0x2E, 0x35, 0x5D, 0x7D };
    
      jsiConsolePrint("\n int: ");
      for(i = 0; i < 128; ++i)
        jsiConsolePrintf("%d,", in[i]);
      jsiConsolePrintf("\n");
    
      jsiConsolePrint("\n as hex: ");
      for(i = 0; i < 128; ++i)
        jsiConsolePrintf("%x,", in[i]);
      jsiConsolePrintf("\n");
    
      jsiConsolePrint("\n as string: ");
      for(i = 0; i < 128; ++i)
        jsiConsolePrintf("%s,", in[i]);
      jsiConsolePrintf("\n");
    
      jsiConsolePrint("\n as char: ");
      for(i = 0; i < 128; ++i)
        jsiConsolePrintf("%c,", in[i]);
      jsiConsolePrintf("\n");
    

    output:

    int:
    123,35,82,75,38,63,93,37,90,108,121,126,­96,121,44,35,78,195,192,206,161,6,193,15­9,231,158,226,59,181,37,61,141,111,97,24­7,132,126,142,86,56,172,92,17,73,79,66,4­1,211,97,176,235,108,38,156,243,61,207,2­06,186,222,1,250,166,113,184,220,198,15,­154,97,79,210,150,107,198,10,235,131,134­,21,231,112,183,50,100,147,164,100,233,2­11,42,58,163,71,225,236,176,146,103,250,­186,141,42,68,41,122,14,13,121,204,22,15­1,117,104,183,133,135,191,184,132,72,67,­74,170,236,83,242,47,
    as hex:
    7b,23,52,4b,26,3f,5d,25,5a,6c,79,7e,60,7­9,2c,23,4e,c3,c0,ce,a1,6,c1,9f,e7,9e,e2,­3b,b5,25,3d,8d,6f,61,f7,84,7e,8e,56,38,a­c,5c,11,49,4f,42,29,d3,61,b0,eb,6c,26,9c­,f3,3d,cf,ce,ba,de,1,fa,a6,71,b8,dc,c6,f­,9a,61,4f,d2,96,6b,c6,a,eb,83,86,15,e7,7­0,b7,32,64,93,a4,64,e9,d3,2a,3a,a3,47,e1­,ec,b0,92,67,fa,ba,8d,2a,44,29,7a,e,d,79­,cc,16,97,75,68,b7,85,87,bf,b8,84,48,43,­4a,aa,ec,53,f2,2f,
    as string:
    ,,,,,,%,,,M%,%,,M%,%,M%,,,,M%,,%,,%,,,,,­,%,,,,,%,,M%,,,,M%,M%,M%,%,%,,,,,%,M%,,M­%,,M%,,,,,,,
    %,,,%,M%,,,,,%,,,,,,,,,,%,,M%,,,M%,,M%,M­%,,,,,,,%,,M%,,,,,,,M%,,,,%,%,M%,,,%,M%,­,%,,,M%,M%,M%,,,,,,,,
    as char:
    {,#,R,K,&,?,],%,Z,l,y,~,`,y,,,#,N,Ã,À,Î,­¡,,Á,,ç,,â,;,µ,%,=,,o,a,÷,,~,,V,8,¬,\,,I­,O,B,),Ó,a,°,ë,l,&,,ó,=,Ï,Î,º,Þ,,ú,¦,q,¸­,Ü,Æ,,,a,O,Ò,,k,Æ,
    ,y,Ì,,,u,h,·,…,,¿,¸,,H,C,J,ª,ì,S,ò,/,°,,­g,ú,º,,*,D,),z,,

    The array of hex should be the equivalence of ascii: {"PH":["Result",5.5],"EC":["Result",700]­,"ResTemp":["Result",137.5]}

    However I am still not receiving the correct ascii.

  • Are you sure that above is the correct source code? The one you actually tested? It seems to me that the int and hex output are the same values. So let's concentrate on the hex one, only. In that case it seems as if what you are outputting is

    jsConsolePrintf("%d", in[i] + i);
    

    Does that ring a bell? Are you somewhere modifying the in array? Otherwise it would be an extremely odd bug of jsiConsolePrintf. One which adds an increasing number for each call. And which resets itself which you switch from %d to %x... Unlikely...

About

Avatar for d0773d @d0773d started