Skip to content

Commit

Permalink
self test for 0x1C
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Nov 20, 2024
1 parent 6de39aa commit 3864fe0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/selftest/selftest_tuyaMCU.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,23 @@ void Test_TuyaMCU_Basic() {
SIM_ClearMQTTHistory();
// cause error
//SELFTEST_ASSERT_CHANNEL(15, 666);



// fake time request
NTP_SetSimulatedTime(1732094000);
// Simulate TuyaMCU sending 0x1C request to OBK
CMD_ExecuteCommand("uartFakeHex 55 AA 03 1C 00 00 1E", 0);
// above command will just put into buffer - need at least a frame to parse it
Sim_RunFrames(100, false);
// OBK will reply with 0x1C packet (TUYA_CMD_SET_TIME)
SELFTEST_ASSERT_HAS_SENT_UART_STRING("55AA001C000801180B14090D140388");
// skip optional heartbeat
SIM_UART_ExpectAndConsumeHexStr("55AA00000000FF");
// nothing is sent by OBK at that point
SELFTEST_ASSERT_HAS_UART_EMPTY();

SIM_ClearUART();
}

#endif

0 comments on commit 3864fe0

Please sign in to comment.