[Q] Create a timer to control a customized module #2243
Unanswered
jafarniknam
asked this question in
Q&A
Replies: 1 comment
-
@bigtreetech can you help me , please ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi . I used this BTT firmware to control a laboratory robot (not a 3D printer) and added a new option to the display menu to control a UVC sanitizer. In this menu, it is necessary for user to specify the value of timer and then the display sends the G-code to the motherboard for the UV lamp relay to turn on (M42 P(relay pin) S( LOW or HIGH) : pin status G-code) .
At this point, it is necessary for a timer to start counting and to turn off the UV lamp after the timeout (display sends G-code to the motherboard for turning the relay off)
In your opinion, what is the best way to create a timer in this section?
My idea is to send start printjob timer G-code and get feedback from the motherboard (using commands M75 & M77 & M31)
motherboard : MKS GEN V1.4
Firmware : marlin 2.0 bugfix
display : MKS TFT32 V4.0
display Firmware : modified BIGTREETECH-TouchScreenFirmware
This is the first code I've written to test this part and it worked properly:
`
void menuUVsanitizer(void)
{
KEY_VALUES key_num = KEY_IDLE;
bool timeChanged = true;
menuDrawPage(&loadUnloadItems);
timeReDraw(inputUvTime);
while (infoMenu.menu[infoMenu.cur] == menuUVsanitizer)
{
key_num = menuKeyGetValue();
switch (key_num)
{
case KEY_ICON_0: // Decrease time
if(inputUvTime > 0)
{
inputUvTime--;
timeChanged = true ;
}
break;
}
}
`
Beta Was this translation helpful? Give feedback.
All reactions