This commit is contained in:
Tester23 2025-09-13 22:49:15 +02:00
parent 1d003279f1
commit ff9d0d4fd4

View File

@ -49,30 +49,32 @@ void DMX_Show() {
if (g_dmxBuffer == 0) { if (g_dmxBuffer == 0) {
return; return;
} }
for (int i = 0; i < 2; i++) {
#if WINDOWS #if WINDOWS
// BREAK: pull TX low manually // BREAK: pull TX low manually
HAL_PIN_Setup_Output(dmx_pin); HAL_PIN_Setup_Output(dmx_pin);
HAL_PIN_SetOutputValue(dmx_pin, 0); HAL_PIN_SetOutputValue(dmx_pin, 0);
HAL_Delay_us(120); // ≥88µs HAL_Delay_us(120); // ≥88µs
HAL_PIN_SetOutputValue(dmx_pin, 1); HAL_PIN_SetOutputValue(dmx_pin, 1);
HAL_Delay_us(12); // MAB ≥8µs HAL_Delay_us(12); // MAB ≥8µs
#else #else
#define DMX_BREAK_DURATION_MICROS 88 #define DMX_BREAK_DURATION_MICROS 88
uint32_t breakBaud = 1000000 * 8 / DMX_BREAK_DURATION_MICROS; uint32_t breakBaud = 1000000 * 8 / DMX_BREAK_DURATION_MICROS;
HAL_SetBaud(breakBaud); HAL_SetBaud(breakBaud);
HAL_UART_SendByte(0); HAL_UART_SendByte(0);
HAL_UART_Flush(); HAL_UART_Flush();
HAL_SetBaud(250000); HAL_SetBaud(250000);
#endif #endif
//HAL_UART_Init(250000, 2, false); //HAL_UART_Init(250000, 2, false);
// restore UART and send DMX data // restore UART and send DMX data
for (int i = 0; i < DMX_BUFFER_SIZE; i++) { for (int i = 0; i < DMX_BUFFER_SIZE; i++) {
HAL_UART_SendByte(g_dmxBuffer[i]); HAL_UART_SendByte(g_dmxBuffer[i]);
}
//Serial485.begin(250000, SERIAL_8N2, RS485_RX_PIN, RS485_TX_PIN);
////Serial485.write(dmxBuffer, sizeof(dmxBuffer));
//Serial485.flush();
} }
//Serial485.begin(250000, SERIAL_8N2, RS485_RX_PIN, RS485_TX_PIN);
////Serial485.write(dmxBuffer, sizeof(dmxBuffer));
//Serial485.flush();
} }
byte DMX_GetByte(uint32_t idx) { byte DMX_GetByte(uint32_t idx) {