For more than one reason, the straight key on the rig has locked on several times causing me to have to lower the rig to reset the software. The first issue was that long dtimes were being erroneously sent. I placed a limiter in the client side script. That worked, but then, when a long message was sent, the key locked on again.
Change the host script so that long values greater than 2000 will be ignored.
Add positive feedback to skeyer.py to indicate that the message has been received and the WiFi channel to the Pico is available again. (I believe the pico might become unavailable.)
Add a command, light/unlocksk, that resets dtime and utime and expires all sleep commands.
ChatGPT, aka Penelope, suggests
import threading
import time
# Function to perform the task you want to interrupt
def task():
print("Task started")
time.sleep(10) # Replace 10 with the duration of your sleep
# Function to stop the task
def stop_task():
print("Task stopped")
# Start the task in a separate thread
thread = threading.Thread(target=task)
thread.start()
# Wait for a certain duration before stopping the task
time.sleep(5) # Replace 5 with the duration after which you want to stop the task
# Check if the thread is still alive
if thread.is_alive():
# If the thread is still running, interrupt it
thread.join(timeout=0)
if thread.is_alive():
# If the thread is still alive after joining, it didn't respond to the interrupt
print("Task could not be stopped")
else:
print("Task stopped successfully")
else:
print("Task has already completed")
# If the task is not completed within the timeout, assume it's not responding to the interrupt
but cautions that
"This approach allows you to interrupt a long-running task, such as a sleep command, in Python. However, keep in mind that not all tasks can be interrupted this way, especially if they're performing blocking I/O operations or other non-interruptible tasks."
However, I don't thinkk this will be an issue, becasue we turn on the GPIO pin, and then sleep.
For more than one reason, the straight key on the rig has locked on several times causing me to have to lower the rig to reset the software. The first issue was that long dtimes were being erroneously sent. I placed a limiter in the client side script. That worked, but then, when a long message was sent, the key locked on again.
Change the host script so that long values greater than 2000 will be ignored.
Add positive feedback to skeyer.py to indicate that the message has been received and the WiFi channel to the Pico is available again. (I believe the pico might become unavailable.)
Add a command, light/unlocksk, that resets dtime and utime and expires all sleep commands.
ChatGPT, aka Penelope, suggests
but cautions that
"This approach allows you to interrupt a long-running task, such as a sleep command, in Python. However, keep in mind that not all tasks can be interrupted this way, especially if they're performing blocking I/O operations or other non-interruptible tasks."
However, I don't thinkk this will be an issue, becasue we turn on the GPIO pin, and then sleep.