External control panel

This Section is for users to discuss hardware

External control panel

Postby Ruslan » Mon Dec 11, 2023 5:16 pm

Hi, I decide to make external control panel for UCCNC. Alphabetic and numeric keyboard is in manner as in Haas machhines. I think that such keyboard layout is more preferable for hand coding. I worked some years on Haas machine and was satisfied with it's keyb layout. It allowed me to write small progs very quickly. All this keys will be managed by MCU as USB HID keyboard.Can anybody give advise what keys are needed to add. I only begin to work with UCCNC but already know what most commonly used keys I need.
Control panel ASM.jpg
Ruslan
 
Posts: 22
Joined: Wed Jan 25, 2023 11:05 am

Re: External ontrol panel

Postby Ruslan » Tue Jan 30, 2024 12:18 pm

Hi, I just finished software and hardware assembling for usb keyboard emulation. In USB sniffer software I can see that PC gets all packets from my keyboard. All alphabetical and numerical keys for writing text is works good. For executing all other functions( zeroing axis, jogging and others) I decided to use hex values that are not used for text entering, I used values from 0x53 to 0x71.It is from "Keypad Num Lock and Clear" to "Keyboard F21" in Universal Serial Bus HID Usage Tables. It seems that UCCNC does not accept values greater than 0x65.
Ruslan
 
Posts: 22
Joined: Wed Jan 25, 2023 11:05 am

Re: External ontrol panel

Postby Ruslan » Tue Jan 30, 2024 12:21 pm

ALL.jpg

MainKeyboard.jpg

MotherBoard STM32F103RCT6.jpg
Ruslan
 
Posts: 22
Joined: Wed Jan 25, 2023 11:05 am

Re: External ontrol panel

Postby Ruslan » Tue Jan 30, 2024 12:30 pm

What is the meaning of number in prompt window for entering Hot key? For example I push "a" on keyboard and it gives number 65. What it is? It is not hex nor dec value of "a" in Universal Serial Bus HID Usage Tables.
Ruslan
 
Posts: 22
Joined: Wed Jan 25, 2023 11:05 am

Re: External control panel

Postby cncdrive » Tue Jan 30, 2024 6:52 pm

65 is the ASCII code of the letter A.
cncdrive
Site Admin
 
Posts: 4741
Joined: Tue Aug 12, 2014 11:17 pm

Re: External control panel

Postby Ruslan » Wed Jan 31, 2024 4:35 am

And what about accepting hex values greater than 0x65? For function keys I don't want to use keys that are using for entering letters and numbers. I have an idea to use a combination of CTRL with alphabetical keys, but keys out of range 0x65 are more preferable.
Ruslan
 
Posts: 22
Joined: Wed Jan 25, 2023 11:05 am

Re: External control panel

Postby dezsoe » Wed Jan 31, 2024 9:23 am

You can do it. You don't need to enter the values for the buttons: just press the SET button and then the key on your keyboard.
dezsoe
 
Posts: 2078
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: External control panel

Postby Ruslan » Wed Jan 31, 2024 10:25 am

dezsoe wrote:You can do it. You don't need to enter the values for the buttons: just press the SET button and then the key on your keyboard.

I know it. UCCNC does not accept if the packet from usb has key value greater than 0x65. I see all packets coming from my keyboard to PC with sniffer software.For example I send Report of 8 bytes 0x00 0x00 0x70 0x00 0x00 0x00 0x00 0x00, it does not accept and nothing appears in window with key press prompt. But if I send 0x00 0x00 0x50 0x00 0x00 0x00 0x00 0x00 I get ascii number 37(it is left key on keyboard). What range of ascii values can be used for assigning them to hot keys?
Ruslan
 
Posts: 22
Joined: Wed Jan 25, 2023 11:05 am

Re: External control panel

Postby dezsoe » Wed Jan 31, 2024 11:51 am

I didn't go into the USB communication. I simply modified one of the sample codes for the keyboard library to press some buttons and it all worked in UCCNC. I used a DUE board which has the ARM at91sam3x8e processor. The last test was Shift+F2, here is the code:

Code: Select all
#include <Arduino.h>

#include "Keyboard.h"

const int buttonPin = 4;         // input pin for pushbutton
int previousButtonState = HIGH;  // for checking the state of a pushButton

void setup() {
  // make the pushButton pin an input:
  pinMode(buttonPin, INPUT_PULLUP);
  // initialize control over the keyboard:
  Keyboard.begin();
  pinMode(13, OUTPUT);
}

void loop()
{
  int buttonState = digitalRead(buttonPin);
  if (buttonState != previousButtonState)
  {
    if (buttonState == LOW)
    {
      digitalWrite(13, HIGH);

      Keyboard.press(KEY_LEFT_SHIFT);  // press and hold Shift
      Keyboard.press(KEY_F2);          // press and hold F2
      // Keyboard.press('a'); // A
      delay(50);
      Keyboard.releaseAll();           // release both

      digitalWrite(13, LOW);
    }
    previousButtonState = buttonState;
  }
}
dezsoe
 
Posts: 2078
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: External control panel

Postby Ruslan » Wed Jan 31, 2024 7:37 pm

My project implements smart keyboard. It automatically inserts spaces before letters and no spaces when you write code in brackets. It is made for entering plain text comments and conditional statements. You don't need to deal with space key every time. Also all letters are written in uppercase. I don't want to abandon the project and will try to finish it. But I will be not satisfied if I will be forced to apply hex values of already used keys, even if I will use a combination of Alt, Shift or Ctrl with alphabetical keys. Using unique, non-repeating key codes is more safe for operating machine. One more question, can I test my keyboard in Uccnc running in demo mode? Or it has limitations and I must test in working mode? I ask because when I trying to reset all functions to no function for hotkey and closing this window I see that coordinates in dro began to change. And I cant stop moving even with pressing Cycle Stop screen button. Only shut down of uccnc helps.
Ruslan
 
Posts: 22
Joined: Wed Jan 25, 2023 11:05 am

Next

Return to Hardware

Who is online

Users browsing this forum: No registered users and 8 guests