¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: SIMPL+ help...REMOVE


etienneterblanche
 

Thanks Chip! Worked Great!

--- In Crestron@..., "Chip" <cfm@...> wrote:


You're removing up to the &#92;x0D, which means that the >next< string to be removed is going to have &#92;x0A as the first byte, so your first three characters are never going to match what you're looking for. Try doing your FIND/REMOVE against "&#92;x0D&#92;x0A".

Instead of looking for the third instance, you might be better off doing your removes against the first, and just have your parsing code check to see if the REMOVED string is long enough to possibly contain your data before parsing it. By searching for every third instance, I'd be worried about data getting out of alignment whack.

After checking the length of your removed string, you can simplify your UID check by doing something like

IF (LEFT(tempStr, 3) = UID$)
{
do stuff
}

- Chip


--- In Crestron@..., "etienneterblanche" <etienne@> wrote:

Hi,

I need to extract the a section of the following string to get the current status of an indoor Daikin unit.

Tx$ to CoolMaster = stat3 101&#92;x0D&#92;x0A

Rx$ from CoolMaster = &#92;x0D&#92;x0A101 OFF 32C 24C Low Dry OK 1&#92;x0D&#92;x0AOK&#92;x0D&#92;x0A&#92;x0D&#92;x0A

I currently use the following, but for some reason it doesn't update any of the serial outputs.

Some notes:
1) UID$ = 3 digit serial I'm passing to the SIMPL+ module

2) The first 3 characters of the REMOVE string must match UID$. In this example it is "101".

3) The rest of the sections within the REMOVE string always starts at the same char position within the string.

----------------------------------------------------------------------
CHANGE Rx$
{
WHILE (FIND("&#92;x0D",Rx$,3))
{
tempStr = REMOVE("&#92;x0D",Rx$,3);
VAL1 = ATOI(UID$);
VAL2 = ATOI(LEFT(tempStr, 5));

IF (VAL2 = VAL1)
{
Status$ = mid(tempStr, 7, 3);
Set_Temp$ = mid(tempStr, 11, 3);
Room_Temp$ = mid(tempStr, 15, 3);
Fan_Speed$ = mid(tempStr, 19, 4);
Operation$ = mid(tempStr, 24, 4);

tempStr = "";
}

ELSE
{
tempStr = "";
VAL1 = 0;
VAL2 = 0;
}

}
}
----------------------------------------------------------------------

Thank you!!
Et

Join [email protected] to automatically receive all group messages.