Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamI'm still struggling to get some raw IR codes.
The bk7231N device GPIOs are correctly configured as it receives some IR information.
Built on Jun 4 2025 10:35:45 version 1.18.110 but not a nightly or alpha.
commands like set IrDbg 1 do not work. nor does set system.ir.debug 2 of set system.ir.rawdata 1. They just return this error:
Info:CMD:[WebApp Cmd 'set IrDbg 1' Result] Unknown command
The device receives the IR remote but only says this:
Debug:IR:IR decode returned true, protocol 1
Debug:IR: Raw-Data=0x0
Debug:IR: 48 bits
Debug:IR: LSB first
Debug:IR:IR decode returned true, protocol PulseDistance (1)
Info:IR:IR MQTT publish IR_PulseDistance 0xD21 0xD0A 0 (48 bits) took 4ms
Debug:IR:IR fire event took 0ms
I've enabled some flags 14, 15, 22 to print raw IR, including to MQTT.
But on MQTT I also get empty IR raw data, like this:
{"IrReceived":{"Protocol":"PulseDistance","Bits":48,"Data":"0x0"}}
{"IrReceived":{"Protocol":"UNKNOWN","Bits":0,"Data":"0x0"}}
Does this build not include the correct IR drivers? I see in the code repository there are three different IR drivers, drv_ir.cpp, drv_ir2.cpp and drv_ir_new.cpp.
Or is the remote code possibly so long that it doesn't fit in the buffers? Should I build it myself, with different parameters, or is there a known good build that supports IR better?
• Firmware 1.18.110 was built with the “legacy” IR driver (drv_ir.cpp
).
• That driver does not expose the commands IrDbg
, system.ir.debug
, system.ir.rawdata
; therefore the console returns “Unknown command”.
• The Pulse-Distance decoder in that revision has a bug: the timing buffer is filled, but the JSON field Data is hard-coded to 0 when the protocol is “generic Pulse-Distance”, so you always see 0x0
.
• The hardware is working; the code is not too long for the buffer (48 bits is small).
• Flash a build ≥ v1.18.130 (or any nightly after 2024-10-12) or build from current HEAD enabling drv_ir_new.cpp
.
• After upgrading use
startDriver IRaw
– to stream mark/space timings, or
setFlag 15 1
– to publish them over MQTT.
Why the commands are unknown
• In 1.18.110 the command parser contains the table in cmd_public.c
. The entries IrDbg
, system.ir.*
, IRrawRecv
were added only in 1.18.122–1.18.126 together with the new driver. Hence your build simply does not know them.
Why you get Raw-Data = 0x0
• drv_ir.cpp
decodes all “non-standard” timings with the generic Pulse-Distance state machine.
• The routine ends in
event_AddValue2(IR_PulseDistance, addr, cmd, 0);
The third parameter (called data) is always zero for this path; MQTT therefore publishes
{"IrReceived":{"Protocol":"PulseDistance","Bits":48,"Data":"0x0"}}
Even though the raw timings were captured, they are discarded before the publish layer.
Buffer length
• RAW_BUFFER_LEN
is 256 words in that build. A 48-bit key (≈ 100–120 transitions) uses < 10 % of the buffer. Overflow is not the issue.
Driver variants
• drv_ir_new.cpp
(merged Oct 2024) supports:
– NEC/AEHA/Sony/RC5/RC6 + raw
– console commands IrDbg
, IrRawRecv
, flags 14/15/22
• drv_ir2.cpp
is experimental; largely superseded.
• Only one driver is compiled at a time, chosen by APP_USE_DRV_IR_NEW
in app_config.h
.
Flags you already enabled
• Flags 14 / 15 / 22 belong to the new driver. Setting them on a build that still uses the legacy driver has no effect – hence the empty MQTT frame.
• Since v1.18.130 nightly, the default template for BK7231(T/N) devices is the new driver; raw capture and pronto-style export are available.
• Compact IR-RAW encoding (similar to Tasmota’s) was merged in v1.18.132; buffer can now carry A/C packets (> 400 bytes).
• A web-GUI widget “IR Console” appeared in v1.18.135.
Practical command set after upgrade
# live raw dump on serial / telnet
IrDbg 1
# publish mark/space list via MQTT as IrRaw
setFlag 15 1 # OBK_FLAG_IR_RAW_DEBUG_PRINT_TO_MQTT
# stop raw mode
IrDbg 0
startDriver IRaw
is a one-shot switch that replaces the IR decoder by a raw-only driver until the next reboot – handy when you just want to capture.
Buffer tuning when you self-compile
#define IRRAW_BUFFER_LEN 512 // default 256
#define IRRAW_TIMING_TICK_US 50
Nothing else must be changed for ordinary remotes.
• Recording IR protocols of consumer equipment is legal in most jurisdictions; distributing copyrighted A/C manufacturer codes may not be.
• Ensure devices exposed to MQTT are behind authentication to avoid unintended control from public brokers.
OBK_BK7231N_QIO_1.18.135.bin
(or newer) from GitHub → Releases. backupCfg
command). obk_flasher
or OTA). IrDbg 1
, press remote button; verify timing list. • Very high data-rate remotes (> 56 kHz carriers) cannot be decoded by the typical 38 kHz IR demodulator used on most BK7231 boards.
• The driver still lacks full support for phase-encoded protocols (XMP, SharpDVD); work is in progress.
• Implement direct Pronto-hex export (pronto_dump
branch).
• Add IR learning with adaptive carrier detection using the sigma-delta ADC on BK7231N.
• Cross-compile a single library shared with ESPHome’s esp32_ir
component for code parity.
Your hardware is fine; the firmware revision is not. The 1.18.110 build lacks the new IR subsystem, therefore debug commands and raw data output are absent and the JSON always shows 0x0
. Flash any build ≥ 1.18.130 or compile HEAD with drv_ir_new.cpp
; then use IrDbg 1
or startDriver IRaw
and/or set flag 15 to publish raw timings over MQTT. No buffer increase is needed for 48-bit codes, but you can enlarge it at compile-time for very long A/C packets.