Help with /mrx,y wifi command

Do you have a question on how to do something.
Ask in here.
Post Reply
rrodriguess
Posts: 133
Joined: Sun Mar 09, 2014 11:01 am
Location: Santos - Brazil

Help with /mrx,y wifi command

Post by rrodriguess »

Hi there

The /mrx,y wifi command returns a string with memory values in hexdecimal between x and y location.

Let's say I use /mr100,199. It returns:

<MEM>001000173B3C4B1E05010217320A0F160F0F0F0162550F0005850205100A140015000A020119050F0117012C013C000A010101010101010100010001010000000093021E0A00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</MEM>

Despite that I already know the value is in hexdecimal, I just don't know how to go on from there. I mean.. how do I decode it? How can I separate the values from each memory (100-199)?

Can someone help?

Rafa
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Help with /mrx,y wifi command

Post by binder »

if it's sending you the block of memory, you will decode the block (like you know).
you have to look at each memory location to know if it's 1 or 2 bytes for the memory.
so if locations 100 thru 125 are 1 byte, then you know you only need 1 value for those locations. then for any location that is an int memory, you need 2 values (2 bytes make an int).

in your example, you should be getting 100 values (memory locations 100 thru 199). the first value is location 100, etc.

the memory range just gives you a continuous section of memory and you have to know how to interpret it.

Sent from my XT1585 using Tapatalk
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Help with /mrx,y wifi command

Post by binder »

I need to add that the values are hex coded with a leading 0 if it's a single value. so it appears that the values are 2 values and 4 values. so 0F is 15 and 10 is 16.
so byte memory locations use 2 digits and int locations use 4 digits.

look at RA_Wifi.cpp in the libraries at the memory raw command.

Sent from my XT1585 using Tapatalk
rrodriguess
Posts: 133
Joined: Sun Mar 09, 2014 11:01 am
Location: Santos - Brazil

Re: Help with /mrx,y wifi command

Post by rrodriguess »

Binder

Perfect... I got it. So... just for the sake of documentantion:

Code: Select all

void resetInternalMemory(){
   if (InternalMemory.read(100)) {
     //set reset Internal Memory to False 
     InternalMemory.write(100,0);
     
     InternalMemory.write(101,16); // LIGHTS_ON_H;
     InternalMemory.write(102,0);  // LIGHTS_ON_M;
     InternalMemory.write(103,23); // LIGHTS_OFF_H;
     InternalMemory.write(104,59); // LIGHTS_OFF_M;
  }
}
From 100 to 104 they are all Bytes types. From the /mr100,105 I get:

<MEM>001000173B</MEM>

Memory Address 100; Hex Value 00; Dec Value: 0
Memory Address 101; Hex Value 10; Dec Value: 16
Memory Address 102; Hex Value 00; Dec Value: 0
Memory Address 103; Hex Value 17; Dec Value: 23
Memory Address 104; Hex Value 3B; Dec Value: 59

tks binder.. it really helped

Rafa
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Help with /mrx,y wifi command

Post by binder »

glad it helped! :smile:

Sent from my XT1585 using Tapatalk
rrodriguess
Posts: 133
Joined: Sun Mar 09, 2014 11:01 am
Location: Santos - Brazil

Re: Help with /mrx,y wifi command

Post by rrodriguess »

Binder

Using this new example:

Code: Select all

void resetInternalMemory(){
   if (InternalMemory.read(100)) {
     //set reset Internal Memory to False 
     InternalMemory.write(100,0);
     
     InternalMemory.write(101,16); // LIGHTS_ON_H;
     InternalMemory.write(102,0);  // LIGHTS_ON_M;
     InternalMemory.write(103,23); // LIGHTS_OFF_H;
     InternalMemory.write(104,59); // LIGHTS_OFF_M;
     InternalMemory.write_int(105,645); //INT !!!!! PH_INFERIOR_BOUND;
     InternalMemory.write(107,5); //PH_DELAY_TIME_M;
  }
}
From the /mr100,108 I get:

<MEM>001000173B850205</MEM>

Memory Address 100; Hex Value 00; Dec Value: 0; [byte]
Memory Address 101; Hex Value 10; Dec Value: 16 [byte]
Memory Address 102; Hex Value 00; Dec Value: 0 [byte]
Memory Address 103; Hex Value 17; Dec Value: 23 [byte]
Memory Address 104; Hex Value 3B; Dec Value: 59 [byte]
Memory Address 105 and 106; Hex Value 8502; Dec Value: 34050 [int] ---> WRONG?
Memory Address 107; Hex Value 05; Dec Value: 5 [byte]


Memory Address 105 and 106 returns 85 and 02 respectivally. Decoding to decimal I get 34050 instead of 645 (hard coded).

Is that right? Is it backwards? Shouldn't returns 02 and 85 that decoding returns 645?

Best Regards
Rafa
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Help with /mrx,y wifi command

Post by binder »

let me look into it a little bit. I didn't write the memory raw function and it's been a while since I looked at it completely.
so i will look closer at the code today and then reply back.

Sent from my XT1585 using Tapatalk
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help with /mrx,y wifi command

Post by rimai »

Little Indian and big Indian notation.
Some adopt big and some adopt little.
Roberto.
rrodriguess
Posts: 133
Joined: Sun Mar 09, 2014 11:01 am
Location: Santos - Brazil

Re: Help with /mrx,y wifi command

Post by rrodriguess »

It is different from hardware to hardware, right? There is no right or wrong... Humm let's use little indian then...

Already changed this morning. My chatBot is finish. Now I receive push notifications on my phone, and can control RA throught whatsapp similar app.

Tks Roberto
Tks Binder
Image
Post Reply