Message Component - Reset?

More
6 years 9 months ago #154266 by phillc54
Replied by phillc54 on topic Message Component - Reset?
If you use .axisrc it needs to be in your home directory (I should have said ~/.axisrc). It is then used by every LinuxCNC config.

A USER_COMMAND_FILE allows you to define a different file for each config and it will take precedence over ~/.axisrc if you have both.
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago - 6 years 9 months ago #156046 by chimeno
Replied by chimeno on topic Message Component - Reset?
Hi Phill,
With your guide example I want to perform the PC shutdown by means of a hal-pin, how could a message appear on the screen "turning off PC" wait 5 seconds and turn off, for now this is what I have ...
Code:
def user_hal_pins(): comp.newpin('turn-off-machine', hal.HAL_BIT, hal.HAL_IN) comp.newpin('turn-off-machine.is-on', hal.HAL_BIT, hal.HAL_OUT) comp.ready() def user_live_update(): if bool(comp["turn-off-machine"]): comp ["turn-off-machine.is-on"] = False else: os.system('systemctl poweroff')
tried with these but it just didn't work for me ..
Code:
time.sleep(5) os.system('notify-send -t 10 -u low "turning off..."') tkMessageBox.showinfo("turning off...", "power off")
I get errors together, if you can help me with some guidance, thank you.
Greeting
Chimeno
Last edit: 6 years 9 months ago by chimeno.

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #156612 by phillc54
Replied by phillc54 on topic Message Component - Reset?
Sorry, I meant to reply earlier but I got a bit sidetracked.

I think the following will do what you want:
Code:
sdShow = False sdCount = 0 sdSecs = '543210' def user_hal_pins(): comp.newpin('turn-off-machine', hal.HAL_BIT, hal.HAL_IN) comp.ready() def user_live_update(): global sdShow, sdCount, sdStart, sdLabel, sdWindow if comp['turn-off-machine'] and s.interp_state == linuxcnc.INTERP_IDLE: if not sdShow: sdStart = time.time() sdWindow = Tkinter.Toplevel(relief='ridge', borderwidth=4) sdWindow.title('SHUTDOWN') sdLabel = Tkinter.Label(sdWindow, fg='red', font='sans 16 bold') sdLabel.pack() sdShow = True else: if sdCount > 5: sdWindow.destroy() os.system('systemctl poweroff') elif time.time() > sdStart + sdCount: msg = 'Turning machine off in {} seconds'.format(sdSecs[sdCount]) sdLabel.config(text=msg) sdCount += 1 elif sdShow: sdWindow.destroy() sdShow = False sdCount = 0
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #156893 by chimeno
Replied by chimeno on topic Message Component - Reset?
Hi @phillc54
  Thank you very much for the help, I will study your example!

regards
Chimeno

Please Log in or Create an account to join the conversation.

Time to create page: 0.352 seconds
Powered by Kunena Forum