PAC displaying text on a Colour Touch page

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by pgardiner, Jun 6, 2014.

  1. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Gents,

    I can read one of 8 temperatures by polling a E5031TS sensor. This works and is used to control a series of under floor heating manifolds.

    But, I want to display the returned value on a say page 4 on the touchscreen. The monitor function is not good for me as I add a calibration function to each sensor. The monitor cant display the calibrated value. Client wants precise values.
    My problem is how to write/display text to a particular Touch Screen page, say page 4.

    The code below works for me but it writes the text to every page. I want it for say page 4.

    { Read E5031TS temperature sensor value every x seconds }
    { Copyright Masar UK Limited }

    if GetUnitParamStatus(254, 90, ptTemperature) then
    begin
    DisplayTemp := GetUnitParameter(254, 90, ptTemperature)-0.5;
    { With calibration}

    { Display the E5031TS temperature value on Touch Screen, red text when reading sensor }

    ClearScreen;
    SetFontName('ArialBold');
    SetFontSize(12);
    SetFontColor(clRed);
    TextPos(195, 115);
    DrawText(DisplayTemp:5:2, '?C');
    Delay(1);

    ClearScreen;
    SetFontName('ArialBold');
    SetFontSize(12);
    SetFontColor(clBlack);
    TextPos(195, 115);
    DrawText(DisplayTemp:5:2, '?C');
    { Change read timer here in seconds }
    Delay(10);
    end;


    Any help, thanks.
     
    pgardiner, Jun 6, 2014
    #1
  2. pgardiner

    Roosta

    Joined:
    Nov 22, 2011
    Messages:
    560
    Likes Received:
    1
    Location:
    Australia
    Can you write the value of the temp sens into a systemIO, and then just display it with a level compenent?

    Actually do you even need logic for this? Can you not just read the temp straight from the sensor itself? I am sure I have done that in the past, with graphs n stuff..
     
    Roosta, Jun 6, 2014
    #2
  3. pgardiner

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    Or just stick a text component on the screen and change the text content using SetCompStringProp.
     
    Ashley, Jun 6, 2014
    #3
  4. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Text

    Ashley, thanks for your reply, can you expand on your solution,

    Regards
     
    pgardiner, Jun 6, 2014
    #4
  5. pgardiner

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    Add a text component where you want it. Give it some placeholder text and give it a name (say Text_DisplayTemp) on the general tab. Set font, colour etc.

    In logic just use:

    Code:
    temp_str: string; // Init section
    
    Format(temp_str, DisplayTemp:5:2, '?C');
    SetCompStringProp("page name", "Text_DisplayTemp", "Text Active", temp_str);
    You can also change the other attributes like font, colour etc dynamically in the same way if you need to.
     
    Ashley, Jun 7, 2014
    #5
  6. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Working

    That's great got it working this morning,

    Many thanks, a great solution for me here.
     
    pgardiner, Jun 7, 2014
    #6
  7. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Hi Ashley, just one last small issue,

    I want to simulate the sensor reading or updating its value.

    Essentially changing the displayed font colour to red for 1 second as it reads the value and then back to its original colour,

    I did this with SetFontColor(clRed); before but cant format a solution based on your previous response.

    Regards
     
    pgardiner, Jun 7, 2014
    #7
  8. pgardiner

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    Code:
    temp_str: string; // Init section
    
    Format(temp_str, DisplayTemp:5:2, '?C');
    setCompIntegerProp("page name", "Text_DisplayTemp",  "Font Colour Active", clRed);
    SetCompStringProp("page name", "Text_DisplayTemp", "Text Active", temp_str);
    delay("00:00:01");
    setCompIntegerProp("page name", "Text_DisplayTemp",  "Font Colour Active", clBlack);
    
    If you look under Logic Help/Component Properties it will give you a list of everything you can change.
    Note that Component names and component properties are case sensitive. Given that Pascal is a case insensitive language this is really a bug that hopefully which be addressed at some time.
     
    Last edited by a moderator: Jun 9, 2014
    Ashley, Jun 8, 2014
    #8
  9. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Ashley,

    Many thanks, the code works great, it looks like I had version 3.1 copy of the Logic Engine Programmers Guide, now have a newer version. V 3.1 does not list the SetCompStringProp or similar, I think that's where is was getting lost.

    Now have V4.11 if that's the latest version with all above listed.

    Regards
     
    pgardiner, Jun 9, 2014
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.