• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

A swiss knife for myself - Sensors in my room, 2nd keyboard to PC for macros, iCUE macro part replacement and plenty of development related things

I would like to share my personal project with the community on which I'm working since 2021 April, maybe somebody will find it interesting or benefit from it. The entrie application is written in C++ and it's embedded part in C, everything is open source. My first idea was to be able to connect a second keyboard beside my main one only for macros, but this project a little bit outgrow that :D I've implemented things what I really needed to be more productive and accomplish things faster.

If you want to use/resuse some part(s) of the project or you have a question, feel free to open a Pull Request or write.

Link to the github page for download and for more technical information: https://github.com/kurta999/CustomKeyboard

Quick overview​

1. For Automotive development:​

  1. CAN-USB Transceiver - Send and Receive standard and ISO-TP CAN Frames over CAN bus via computer trough USB - see more info below
  2. CAN Script handler - Execute tests scripts by settings specific frames and sendinig them to the bus automatically
  3. UDS DID Reader & Writer - Read and Write UDS DIDs over GUI, DIDs have to be defined in DidList.xml - DIDs also can be cached locally

2. For General development:​

  1. Command excutor - Bind specific commands (cmds) to GUI buttons, which is then excuted on GUI button click - see more info below
  2. StructParser - Generate offsets of C structures and it's members
  3. TerminalHotkey - Hotkey for terminal, like in Linux. Can be launched from Windows Explorer with current path as starting directory and from Desktop
  4. File explorer opener - Open file explorer by sending a specific TCP packet to this application

3. For Personal use:​

  1. CustomMacro - Connect a second keyboard and binding macros to it's keys - full GUI support for macro editing with macro recorder
  2. Sensors - TCP Backend for sensors with SQLite database for measurements & HTTP Web server for reading measurement's graphs. By default, graphs can be accessed at: http://localhost:2005/graphs
  3. Backend for Corsair's G Keys - Bind macros to G keys as those were on second keyboard, without even installing iCUE
  4. AntiLock - Bypass idle timeout for Windows to avoid lock screen by pressing SCROLL LOCK & moving mouse in given interval. Can be useful for workstations if you can't disable idle logout or you're being monitored.
  5. AntiNumLock - Doesn't allow to disable NumLock, re-enables it immendiately when it's disabled.
  6. CPU Power Saver - Saves power by reducing CPU frequency after X idle time to Y percent. For example I can save 10-15W hourly by reducing my overclocked i7 10700K to 800 - 1200Mhz while my PC is in idle. If the median CPU usage gets above max configured percent due to some background tasks, the frequency will be restored and won't be limited again until it falls below configured minimum median load again.
  7. ScreenshotSaver - Saving screenshot to .png from clipboard
  8. DirectoryBackup - Backup folders to another place(s) from tray menu
  9. Filesystem browser - List files and directories recursively by size starting from specific path - useful for finding bloat on storage
  10. wxWidget's GUI editor - A very basic GUI editor with move & resize support *(1)
  11. MTA -> SA-MP MapConverter - Convert maps from MTA-SA Race and MTA:SA DM to SA-MP with every item which is supported by SA-MP; objects, actors, vehicles with components, checkpoints and pickups.
  12. LinkCreator - Easy symlink & hardlink creator within Windows' file explorer
*(10) This is an outdated part of this project, it doesn't support sizers. It's not recommended to create GUI without sizers, only use it if you know what you are doing.

In depth details of implemented features​

1. For Automotive development:​

  1. CAN-USB Transceiver - Requires LAWICEL CAN USB or NUCLEO-G474RE board with UART-TTL to USB adapter & Waveshare SN65HVD230 3.3v CAN Transceiver or something else which converts TTL signals to real CAN signal. Supports standard, extended, ISO-TP (ISO 15765-2) CAN frames (eg. for sending and receiving UDS frames easily), logging and searching between them. Bits and bytes for CAN frame also can be binded to be able to manipulate them easyer with GUI. Firmware for nucleo board is available here: https://github.com/kurta999/CANUSB
  2. CAN Script handler - Execute tests scripts by settings specific frames and sendinig them to the bus automatically
  3. UDS DID Reader & Writer - Supported DID types: uint8_t, uint16_t, uint32_t, uint64_t, string, bytearray. Strings and bytearrays are padded when their lenght is smaller than the predefined length, otherwise truncated.

2. For General development:​

  1. Command excutor - Binding commands to GUI buttons possible in Cmds.xml or in the "CMD Executor" panel. That command will be executed on Windows with CreateProcess if you click on it's button, see the image below. This is very usful feature if you work often with command line, you don't have to copy paste every comand or type it's alias. Currently one variable parameter can be added to each command, you can change that before execution by clicking with MIDDLE mouse to the command button instead of the LEFT.
  2. StructParser - Paste the structure to input dialog and click on prarse. The application automatically calculates offsets for it's members. It's useful if you work with communication and had to calculate the offset of members in bytes manually. Supports embedded structures, struct alignment (fixed alignment supported, pragma pack implementation isn't finished yet), preprocessor definitions & unions.
  3. File explorer opener - This function can be useful if you work with VirtualBox or WSL and using samba for accessing specific parts on guest OS filesystem. First you have to map the network drive in Windows, default drive character is Z: (can be changed in settings.ini - "SharedDriveLetter"), also don't forget to enable TCP_Backend in settings.ini. Here is an example command for opening the file explorer on Windows: "echo expw$(pwd) | netcat <TCP_Backend port from settings.ini>". For the best experience, I recommend creating an alias for this command.

3. For Personal use:​

  1. CustomMacro - Currently requires an external Nucleo L495ZG board with UART-TTL to USB adapter for transmitting keypresses to PC and additionally an USB A to MicroUSB adapter if your keyboard has USB A port. The nucleo is just a simple USB Host, which receives key-presses from the connected keyboard and transmits it to PC via UART. It could be done with hooking in windows, but this solution always crashed the debugger in MSVC, so I went with the more expensive way - another way would be to create a custom driver for the secondary keyboard, but I do not have time for that. Macros can be added in configuration page or in settings.ini file directly - they can be binded to a global profile or per application, even key combinations are supported too. Firmware for Nucle board is available here: https://github.com/kurta999/UsbHost
  2. Sensors - Backend means simple TCP server where sensor connencts and sends measurements. Each measurement is inserted to a local SQLite database and a graph generated with last 30 measurements, last day & last week average data by default, this can be changed in settings.ini. Database is updated in every 10 minutes, but you can update manually by clicking on "Generate graphs" in front panel. Graphs can be seen at "localhost:2005/graphs" by default.
  3. Backend for Corsair's G Keys - Corsair pretty well fucked up it's iCUE, sometimes memory usage can grow to 500MB. That's enormeous for an application which runs in background and executes macro for binded keys. It's possible to use CustomMacro feature to bind everything to Corsair's G keys (beside second keyboard, of coruse). This is a simple HID API which receives keypresses for G keys. Supports K95 RGB (18 G keys, older one) and K95 RGB Platinum.
  4. ScreenshotSaver - Press the screenshot save key (F12 by default, on second keyboard) and the screenshot from the clipboard will be saved to (app path)/Screenshots folder by default as .png file. Can be changed in configuration.
  5. DirectoryBackup - Setup backups in configuration or in settings.ini manually and those will appear in tray menu of this application. Click on them, and backing up files will start. Supports ignore list & SHA-256 checksum for backed up files for more secure backups.
  6. wxWidget's GUI editor - Oversimplified GUI editor which sometimes can be useful beside wxFormBuilder. GUI items are movable & resizable - directly without sizers. C++ code generation also implemented, current workspace can be saved & loaded to/from XML file.
  7. MTA -> SA-MP MapConverter - If you worry that some webpages will stole your maps during conversion, you can safely use this tool. Even if you don't trust me, you can check the source code and rebuild this project yourself.
  8. LinkCreator - Select desired files from File Explorer and click the mark key (key down on second keyboard by default) and files (directories too) will be marked for link creation. Go to target directory where you want to place the links for marked files, press symlink key (KEY UP) by default for symlink or hardlink key (KEY RIGHT) by default for hardlinks. That's all, symlink or hardlink is created from marked files in target directory.
  9. CryptoPrice - Fetching ETH & BTC buy/sell price from coinbase.com and printing it on main panel - disabled by default. Can be enabled by setting FetchCryptoPrices to 1 in settings.ini

Screenshots​

Main Page

Alt text

Sensors

Alt text

CAN-USB Transceiver

Alt text

CAN-USB Frame mapping

Alt text

CAN-USB UDS Frame sending over ISO-TP protocol

Alt text

UDS DID Handler (Both writing & reading)

Alt text

Structure parser

Alt text

Command executor

Alt text

Filesystem browser

Alt text

Configuration

Alt text

MTA -> SA-MP Map Converter

Alt text

Macro editor

Alt text Alt text Alt text

Backup

Alt text Alt text

GUI Editor

Alt text Alt text

Log

Alt text

Linux​

Main Page

Alt text

MTA -> SA-MP Map Converter

Alt text
 
Joined
Oct 7, 2022
Messages
18 (0.03/day)
Location
Slovakia
System Name Dev + Gaming PC
Processor i7 10700K @4.9Ghz
Motherboard MSI MAG Z490 TOMAHAWK
Cooling Noctua NH-D15
Memory 4x8GB G.SKILL Trident Z DDR4-3200 CL14-14-14-34
Video Card(s) Zotac RTX 3070 8
Storage Samsung 970 Pro 512GB
Display(s) ASUS ROG PG258Q + AOC 24G2U/BK
Case Zalman Z11 NEO
Audio Device(s) Asus Xonar D2X, Logitech Z906
Power Supply Seasonic Prime 850W Titanium
Mouse Razer Deathadder Elite V2
Keyboard Corsair K95 Platinum
Software Windows 11
Images about the macro keyboard with required hardware (the hardware also has my indoor sensors, that's the reason why it is ugly AF. I didn't had the time to organize the cables :D)

IMG_20230421_164205.jpg

IMG_20230421_164218.jpg


Images about CAN-USB hardware:

Alt text

Nucleo board

Alt text

Waveshare CAN transreceiver

Alt text

RS232 head for CAN bus

Alt text

UART-USB converter

Alt text

CubeMX connections

Alt text
 
Top