Anyone know of any scriptable asynchronous communication tools?

The closest so-far appears to be Kermit. It’s been around since CP/M, but apparently there’s still no centralised language reference and the syntax predates Perl.

  • Onno (VK6FLAB)OP
    link
    fedilink
    arrow-up
    1
    ·
    8 months ago

    I started down the bash path but came unstuck when I wanted to create a process that uses a single bidirectional serial port to write a move command, whilst reading the current location and checking to see if an end stop switch was closed to write a stop command.

    Ideally, all of it is interrupt driven, but I’m at a loss to see how I can do this with either Kermit or expect. Both appear to use a send, then wait for a response model, even if you can check for different responses.

    Of note is that the end stop is external to the serial communication, so I can’t check the same stream for that information.

    • HamsterRage@lemmy.ca
      link
      fedilink
      arrow-up
      1
      ·
      8 months ago

      the end stop in external to the serial communication

      Does this mean that you have some kind of other signals or pin-outs? If so, this is starting to sound like a great project for a Raspberry Pi, because the GPIO pin array can handle that.

      • Onno (VK6FLAB)OP
        link
        fedilink
        arrow-up
        1
        ·
        8 months ago

        Yeah, it’s already on a pi, connected to my LAN and the USB port of the CNC. The switch is on a gpio pin.

        I need to automate the calibration of the three axis. In other words, tell the CNC to move a specific distance, then figure out how far it actually moved, update the number of steps per mm, rinse and repeat.

        To implement this, I have a known calibrated distance, a set of three 1-2-3 blocks, so I actually need to move until the switch closes, then ask the CNC how far it thinks it moved.

        I intend to run this several times because right now, doing it manually is giving me weird results and I’m trying to figure out the root cause of the error.

        So, I need to move an axis, interrupt the move if the switch is closed, and keep moving until the switch is closed.

        • HamsterRage@lemmy.ca
          link
          fedilink
          arrow-up
          1
          ·
          8 months ago

          Maybe then you need to move one stop up from scripting into something closer to actually programming. I’d be surprised if Python doesn’t have the library support on a Pi for dealing with both serial and GPIO I/O.

          • Onno (VK6FLAB)OP
            link
            fedilink
            arrow-up
            1
            ·
            8 months ago

            Yeah, I was hoping to avoid that, but it’s been heading that way for a few days now :}

            • HamsterRage@lemmy.ca
              link
              fedilink
              arrow-up
              1
              ·
              8 months ago

              I looked and Python has the library support for the GPIO and to do background threading to poll pins. My preference would be to go with a JVM language like Kotlin, but then I’m a programmer. Python, from the little that I’ve mucked about with it is really just one step in complexity from scripting. Maybe even easier, because some things in shell scripts are super difficult to do.