Skip to content

Instantly share code, notes, and snippets.

View Staars's full-sized avatar

Christian Baars Staars

View GitHub Profile
@Staars
Staars / txt
Created May 19, 2019 09:32
Developer document for Playground MP3Player for TASMOTA
Playground-Driver for DFRobot-MP3-Player:
project aims:
- support complete feature set of the player
-support bidirectional communication, a new pin (MP3 RX is needed)
-high verbositiy of the driver for further development and exploration of different players/firmware versions
-non-blocking design to keep the main loop of TASMOTA as free as possible
-MQTT-interface: mainly geared towards home automation (i.e. direct short audio feedback)
-Web-GUI: usable as a music player with state synchronization with the underlying code via AJAX
-the main intention is NOT the replacement of the current driver in TASMOTA, but more of a development playground and maybe an alternative for certain use cases. Especially the Web-GUI is quite the contrary to the fundamental design principles of the MQTT-centric TASMOTA
@Staars
Staars / xdrv_01_webserver.ino
Last active November 25, 2019 09:09
responsive saturation slider - "over engineered edition"
/*
xdrv_01_webserver.ino - webserver for Tasmota
Copyright (C) 2019 Theo Arends
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@Staars
Staars / object-dump.py
Created December 7, 2019 12:58
# Little convenience script to get an object dump
# Little convenience script to get an object dump
Import('env')
def obj_dump_after_elf(source, target, env):
print("Create firmware.asm")
env.Execute("xtensa-lx106-elf-objdump "+ "-D " + str(target[0]) + " > "+ "${PROGNAME}.asm")
env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", [obj_dump_after_elf])
@Staars
Staars / test.html
Last active December 20, 2019 13:09
canvas_test
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title>Thermal View</title>
<script type="text/javascript">
var rawArray = [768];
const map = (value, x1, y1, x2, y2) => (value - x1) * (y2 - x2) / (y1 - x1) + x2;
var image;
var gradientPixels = [];
@Staars
Staars / Cleargrass-BLE-packet.MD
Created December 26, 2019 11:42
Cleargrass-BLE-packet
    /* All the information is in this Property called "FDCD" on the advertising data.
       The HEX string is as follows:
       "0807453810342d580104f500da02020145" (quotes included)
       To which:
       0807 or 0801: Ignore, but useful to identify relevant data
       453810342d58: MAC address, INVERTED (58:2d:34:10:38:45)
       0104f500da02: Data for Temperature and Humidity, broken as follows
         - 01: Indicates the Temperature and Humidity events
         - 04: Event data length (4, 2 bytes for Temperature, 2 bytes for Humidity)
  • f500: Temperature data inverted (00f5), which translates to 245, equivalent to 24.5C
@Staars
Staars / mj_ht_v1.ino
Created February 1, 2020 08:49
Xiaomi test (from cbm80amiga) with the OLED-part removed
// Reading Xiaomi Mi BLE Temperature & Humidity Monitor
// Code for the video: https://youtu.be/pyhpXnFzNhU
// (C)2019 Pawel A. Hernik
// BLE code based on Dmitry Grinberg and Florian Echtler work
/* PINOUT
nRF24L01 from pin side/top:
-------------
|1 3 5 7 |
|2 4 6 8 |
@Staars
Staars / dec_BLE.c
Created March 6, 2020 18:12
little tool to compute PDU-types and LFSR
#include <stdio.h>
#include <stdint.h>
// insert raw BLE-buffer
uint8_t buffer[] = {0,0,0,0,0,0,0,0, 0x02, 0x01, 06, 0x03, 0x02, 0x95, 0xfe, 0x14, 0x16, 0x95, 0xfe, 0x70, 0x20, 0x98, 0x00, 0xa3, 0x77, 0xb5, 0x6a, 0x8d, 0x7c, 0xc4, 0x0d, 0x04};
void swapbuf( uint8_t len ) {
uint8_t* buf = (uint8_t*)&buffer;
@Staars
Staars / serial-plotter.py
Last active September 14, 2020 18:43
serial plotter for platformio (tasmota)
#!/usr/bin/env python3
"""
serial-plotter.py - for Tasmota
Copyright (C) 2020 Christian Baars
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@Staars
Staars / web.ino
Last active May 31, 2020 14:33
Variation of the Tasmota color slider (tries to solve the "chrome issue")
#ifdef esp8266
"input[type=range]{width:99%%;}"
#else
"input[type=range]{width:99%%;-webkit-appearance:none;background:linear-gradient(0deg, #55555525,transparent);}"
// "input[type=range]{width:99%%;-webkit-appearance:none;background: #55555515;}"
"input[type=range]::-webkit-slider-thumb{-webkit-appearance: none;height:22px;width:22px;background: #dddddd;mix-blend-mode:hard-light;border-radius:5px;}"
#endif // esp826
@Staars
Staars / clipboard-const-converter.py
Last active June 6, 2020 20:00
copy const char ... PROGMEM[] to clipboard and get compressed stub in console
from tkinter import Tk
import unishox
# get text from clipboard expecting something like that:
# const char HTTP_SCRIPT_WIFI[] PROGMEM =
# "function c(l){" // comments
# "eb('s1').value=l.innerText||l.textContent;" // comments
# "eb('p1').focus();" // comments
# // comments
# "}";