Skip to content

Instantly share code, notes, and snippets.

View toxicantidote's full-sized avatar

toxicantidote

View GitHub Profile
@toxicantidote
toxicantidote / macro_pad.ino
Created August 7, 2024 11:10
Media key macro pad
#include "HID-Project.h"
#define PIN_BTN_PREV 11
#define PIN_BTN_PAUSE A1
#define PIN_BTN_NEXT A0
#define PIN_BTN_VOL_DOWN A2
#define PIN_BTN_VOL_MUTE 10
#define PIN_BTN_VOL_UP 9
@toxicantidote
toxicantidote / fridge_fault_bridge.ino
Last active August 5, 2024 11:54
Compressor interfacing for new fridge controller
#include <avr/wdt.h>
// how long to wait after a UART command before considering the link dead and
// resetting self (ms)
#define KEEPALIVE_WAIT 10000
// pins where things are connected
#define PIN_INTERRUPT 2
#define PIN_LED_R 11
@toxicantidote
toxicantidote / fridge_gui.py
Last active August 5, 2024 12:17
Fridge GUI/control
import board
from micropython import const as S
## Screen parameters
LCD_WIDTH = S(130)
LCD_HEIGHT = S(64)
LCD_ROTATION = S(0)
## Button thresholds
THRESHOLD_BLUE = S(8000)
@toxicantidote
toxicantidote / picow_st7735s.py
Created July 13, 2023 23:53
ST7735S display test - CircuitPython (Pico W) - NOT WORKING
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
"""
import board
import terminalio
@toxicantidote
toxicantidote / esp32_st7735s.py
Created July 13, 2023 23:38
ST7735S display test - CircuitPython (ESP32)
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
"""
import board
import terminalio
@toxicantidote
toxicantidote / Nayax sales reporting.py
Created June 28, 2022 08:18
Nayax sales reporting
## standard libraries
import re
import time
import queue
import threading
import json
from tkinter import *
from tkinter import ttk, font, messagebox, filedialog
import datetime
import os
@toxicantidote
toxicantidote / wifi_select.ino
Last active May 22, 2023 01:08
ESP32 Wi-Fi search and connect to saved
#include <WiFi.h>
#include <Preferences.h>
#include <esp_task_wdt.h>
#define CMDPROMPT "ESP32> "
#define TIMEOUT 10000
// cmd line vars
char cmdBuffer[32];
int cmdBufferPosition = 0;
@toxicantidote
toxicantidote / SolarInterface.py
Created April 25, 2022 11:32
MPP solar PIP-1012-MSE interfacing
#!/usr/bin/python3
## which serial port the MPP Solar inverter is connected to
serial_port = '/dev/ttyS0'
###
import serial ## provided by 'pyserial' from pip
import crc16 ## provided by 'crc16' from pip
import sys ## inbuilt library
@toxicantidote
toxicantidote / foxhunter.py
Created August 5, 2021 04:53
Finds Fieldfox units on the LAN
import socket
import threading
import re
class FoxHunter(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.name = 'thread_FoxHunter'
self.units = []
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@toxicantidote
toxicantidote / pinger.py
Last active June 22, 2021 01:26
Network host ping tool
## Site ping check tool ##
##
## Originally developed and tested on Win10 with Python 2.7. Updates made with
## Python 3.7, but should still work on Python 2.x provided the Tk install
## isn't ancient.
##
## Reads one or more files containing details of sites to ping, pings them at
## the defined frequency, and displays the result in a GUI.
##
## Within the host files, the last word on each line is considered to be the