Fixed stuff, added esphome config

This commit is contained in:
7marcus9 2026-10-10 02:32:27 +02:00
parent 4618dc95a9
commit 7fd1dbba18
2 changed files with 73 additions and 8 deletions

View file

@ -0,0 +1,70 @@
# Board: NodeMCU v2 (ESP8266) (NodeMCU)
# Definition: definitions/boards/nodemcuv2/manifest.yaml
esphome:
name: trabantlux-1
friendly_name: TrabantLux-1
on_boot:
priority: 30
then:
- light.turn_on:
id: light_white
brightness: 33%
esp8266:
board: nodemcuv2
logger:
api:
encryption:
key: "JMbOQuANui4S5yDzat0wWVXrhmUO6cpBW2pjBsjRBO4="
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: TrabantLux-1 Fallback Hotspot
password: "oftmAcVPECTy"
uart:
tx_pin: GPIO2
baud_rate: 115200
id: lamp_uart
light:
- platform: monochromatic
name: "Lampe"
id: light_white
output: lamp_output
gamma_correct: 1.0
# - platform: esp32_rmt_led_strip
- platform: neopixelbus
type: GRBW
variant: WS2812
pin: GPIO4
num_leds: 240
name: "NeoPixel Light"
output:
- platform: template
id: lamp_output
type: float
write_action:
- lambda: |-
static int last_value = 0xffff;
uint16_t value = (uint16_t)(state * 255.0f);
if (value == last_value) return;
last_value = value;
uint8_t hi = (value >> 8) & 0xFF;
uint8_t lo = value & 0xFF;
uint8_t data[] = {0x80, lo, 0x00};
id(lamp_uart).write_array(data, sizeof(data));

View file

@ -69,7 +69,8 @@ volatile bool dirty = true;
//uint16_t mem[12] = {0xFFF, 0xFF, 0xFFF, 0xFF, 0xFFF, 0xFF, 0xFFF, 0xFF, 0xFFF, 0xFF, 0xFFF, 0xFF};
//uint16_t mem[12] = {0x300, 0x40, 0x300, 0x40, 0x300, 0x40, 0x300, 0x40, 0x300, 0x40, 0x300, 0x40};
//uint16_t mem[12] = {0xFFF, 0xFF, 0xFFF, 0xFF, 0xFFF, 0xFF, 0xFFF, 0xFF, 0xFFF, 0xFF, 0xFFF, 0xFF};
uint16_t mem[12] = {0x300, 0xff, 0x300, 0xff, 0x300, 0xff, 0x300, 0xff, 0x300, 0xff, 0x300, 0xff};
//uint16_t mem[12] = {0x300, 0xff, 0x300, 0xff, 0x300, 0xff, 0x300, 0xff, 0x300, 0xff, 0x300, 0xff};
uint16_t mem[12] = {0x000, 0x00, 0x000, 0x00, 0x000, 0x00, 0x000, 0x00, 0x000, 0x00, 0x000, 0x00};
uint16_t lookup_ana[256] = {0, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 755, 771, 787, 803, 819, 835, 851, 867, 883, 899, 915, 931, 947, 964, 980, 996, 1012, 1028, 1044, 1060, 1076, 1092, 1108, 1124, 1140, 1156, 1172, 1188, 1204, 1220, 1237, 1253, 1269, 1285, 1301, 1317, 1333, 1349, 1365, 1381, 1397, 1413, 1429, 1445, 1461, 1477, 1493, 1510, 1526, 1542, 1558, 1574, 1590, 1606, 1622, 1638, 1654, 1670, 1686, 1702, 1718, 1734, 1750, 1766, 1783, 1799, 1815, 1831, 1847, 1863, 1879, 1895, 1911, 1927, 1943, 1959, 1975, 1991, 2007, 2023, 2039, 2056, 2072, 2088, 2104, 2120, 2136, 2152, 2168, 2184, 2200, 2216, 2232, 2248, 2264, 2280, 2296, 2312, 2329, 2345, 2361, 2377, 2393, 2409, 2425, 2441, 2457, 2473, 2489, 2505, 2521, 2537, 2553, 2569, 2585, 2602, 2618, 2634, 2650, 2666, 2682, 2698, 2714, 2730, 2746, 2762, 2778, 2794, 2810, 2826, 2842, 2858, 2875, 2891, 2907, 2923, 2939, 2955, 2971, 2987, 3003, 3019, 3035, 3051, 3067, 3083, 3099, 3115, 3131, 3148, 3164, 3180, 3196, 3212, 3228, 3244, 3260, 3276, 3292, 3308, 3324, 3340, 3356, 3372, 3388, 3404, 3421, 3437, 3453, 3469, 3485, 3501, 3517, 3533, 3549, 3565, 3581, 3597, 3613, 3629, 3645, 3661, 3677, 3694, 3710, 3726, 3742, 3758, 3774, 3790, 3806, 3822, 3838, 3854, 3870, 3886, 3902, 3918, 3934, 3950, 3967, 3983, 3999, 4015, 4031, 4047, 4063, 4079, 4095};
@ -83,13 +84,7 @@ uint16_t RX_Buffer[BUFFER_SIZE] = {0};
uint16_t TX_Buffer[BUFFER_SIZE] = {0};
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
if(GPIO_Pin == SPI_INT_Pin) {
hspi2.Instance->CR1 |= SPI_CR1_SSI;
HAL_GPIO_WritePin(INIT_OUT_GPIO_Port, INIT_OUT_Pin, GPIO_PIN_SET);
for (volatile int i = 0; i < 3; i++);
hspi2.Instance->CR1 &= ~SPI_CR1_SSI;
HAL_GPIO_WritePin(INIT_OUT_GPIO_Port, INIT_OUT_Pin, GPIO_PIN_RESET);
}
}
void HAL_SPI_CpltCallback(SPI_HandleTypeDef *hspi) {