| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- ESP32 receive/transmit refactor validation
- Active implementation is entirely in DriverInterface/ESP32_WROOM_32D.c.
- The older wifi_stream.h / wifi_receive_stream.inc files are not included.
- Preserved contracts:
- - WriteComm2(char *, uint16_t) is the only physical send path.
- - g_wifi_rx_buf remains 256 bytes. g_wifi_rx_last is the ISR write cursor;
- g_wifi_rx_head is the main-loop read cursor.
- - Every complete Mini7 message is decoded by the Keil project's existing
- tshell/van_com_algorithm.c DecodeNew, including its legacy checksum rules.
- - Command formatting goes through my_sprintf, now bounded by vsnprintf.
- - Diagnostics use Van_Device_Printf(VAN_LOG_WIFI, ...).
- Receiving:
- - Main loop drains the ring without the former 100ms gate.
- - ISR detects ring-full/ORE; it does not silently overwrite unread bytes.
- - AT lines, prompts and +IPD payloads are consumed in wire order.
- - CIPMUX=1 and CIPDINFO=0 are configured explicitly.
- - STA dispatches connection 0; SoftAP provisioning accepts client IDs 0..4
- through the same streaming parser, without mixing clients' JSON fragments.
- - Mini7 partial frames survive multiple +IPD segments, with a 128-byte maximum
- inbound payload matching CMD_BUF_SIZE. The actual ring stays 256 bytes.
- - Complete frames use a separate contiguous DecodeNew window so decoding
- cannot move the hardware ring cursor or erase newly arrived input.
- Sending:
- - IDLE -> WAIT_PROMPT (3000ms) -> WAIT_RESULT (7000ms) -> IDLE.
- - Payload is sent once per prompt transaction, without a trailing extra byte.
- - TCP connection success is followed by CIPTCPOPT=0,,,6000; only its OK enables
- application TX. UDP skips TCP options.
- - Explicit ERROR before prompt or SEND FAIL after payload releases the pending
- frame; existing application-level ACK/retry logic is responsible for retry.
- - Ambiguous timeout, UART write failure, malformed +IPD or ring overrun latches
- TX_FAULT and sends no further AT. Reset ESP/the device; ready clears the latch.
- There is no hardware ESP reset pin configured in this module.
- - Close/SSID requests are deferred until the current transaction finishes.
- Host test:
- python tests/wifi_refactor/build_host_test.py
- In a Visual Studio compiler shell:
- cl /nologo /TC /utf-8 /DONECHIP_MINI_ONE tests/wifi_refactor/generated.c DriverInterface/cJSON.c /Fe:tests/wifi_refactor/test.exe /Fo:tests/wifi_refactor/
- tests/wifi_refactor/test.exe
- The generator reads the CURRENT production C and actual DecodeNew, not a
- duplicate decoder model. Covers maximum frame fragmentation, ring wrap,
- 1000 frames, binary delimiters, corruption, callbacks receiving new bytes,
- prompt timeout, duplicate prompt, send-result timing, UART error, TCP/UDP setup.
- Repeat with /DONECHIP_MINI_PLUS to test the other device variant.
- Also covers IPD payloads larger than the ring, SoftAP setup/fragmented JSON,
- prompt-only payload release, busy provisioning requests and bounded searches.
- 2026-10-26 hardware smoke test:
- - Full rebuild of mini7_V2_debug with ONECHIP_MINI_ONE: 0 errors, 3 existing
- warnings (debug watchdog unreachable code x2, unused stub_RtR x1).
- - ST-LINK programming and verification passed; application reset and running.
- - COM10 and the existing tool_for_mini TCP/UDP server used for validation.
- - 10:32:32..10:34:37: 58 valid TCP responses, 62 SEND OK, maximum observed
- response gap 5 seconds, no observed checksum errors, UART faults, AT timeouts,
- reset commands or SEND FAIL. Covers periodic status queries, not a full run.
- - Ambient temperature -104 indicates an unloaded sensor channel, unresolved.
- - Both Keil targets share output files: use a full rebuild when changing target.
- - Raw serial/network logs and AXF files are local artifacts, not test sources.
|