Run Initialisation from logic

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Memphix, Feb 10, 2014.

  1. Memphix

    Memphix

    Joined:
    Aug 31, 2006
    Messages:
    248
    Likes Received:
    1
    Location:
    Australia
    Is it possible to make the colour screen run the Initialisation from logic? What does the restart HomeGate function do?

    Thanks
     
    Memphix, Feb 10, 2014
    #1
  2. Memphix

    Matty

    Joined:
    Oct 15, 2004
    Messages:
    131
    Likes Received:
    0
    Hi Memphix,

    The initialisation code is run when the logic engine starts (or restarts). This is typically used for initialising variables or executing a once off event when power is restored following a power failure.

    There is no way to call the initialisation function from logic. I would suggest moving the desired code from the initialisation section into a procedure. This procedure can then be called from the initialisation section as well as any other location in the code.

    Alternatively, but not recommended, you could use the restart function which effectively stops the logic engine and starts it again which causes the initialisation code to be run.

    The restart HomeGate special function causes project settings to be saved, HomeGate to close and then restart.

    Regards,

    Matty
     
    Last edited by a moderator: Feb 10, 2014
    Matty, Feb 10, 2014
    #2
  3. Memphix

    Memphix

    Joined:
    Aug 31, 2006
    Messages:
    248
    Likes Received:
    1
    Location:
    Australia
    Thanks Matty.

    What would be the cleanest way to run a module once when requested?
     
    Memphix, Feb 10, 2014
    #3
  4. Memphix

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,524
    Likes Received:
    173
    Location:
    Adelaide, Australia
    Just put a disableModule call at the end of the module (it doesn't really matter where in the module you put it as the module will run to the end before disabling itself). Then just enable the module when you want it to run. It will run once then disable itself. If you don't want it to run when the screen first starts up, disable the module in the initialisation section.
     
    Ashley, Feb 10, 2014
    #4
  5. Memphix

    Memphix

    Joined:
    Aug 31, 2006
    Messages:
    248
    Likes Received:
    1
    Location:
    Australia
    Perfect, thanks!
     
    Memphix, Feb 10, 2014
    #5
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.