MCPcopy Create free account
hub / github.com/PowerBroker2/DFPlayerMini_Fast / parseFeedback

Method parseFeedback

src/DFPlayerMini_Fast.cpp:1003–1176  ·  view source on GitHub ↗

/ ! @brief Parse MP3 player query responses. @return True if success, false if error. */ /

Source from the content-addressed store, hash-verified

1001 */
1002 /**************************************************************************/
1003bool DFPlayerMini_Fast::parseFeedback()
1004{
1005 while (true)
1006 {
1007 if (_serial->available())
1008 {
1009 uint8_t recChar = _serial->read();
1010
1011 if (_debug)
1012 {
1013 Serial.print("Rec: ");
1014 Serial.println(recChar, HEX);
1015 Serial.print("State: ");
1016 }
1017
1018 switch (state)
1019 {
1020 case find_start_byte:
1021 {
1022 if (_debug)
1023 Serial.println("find_start_byte");
1024
1025 if (recChar == dfplayer::SB)
1026 {
1027 recStack.start_byte = recChar;
1028 state = find_ver_byte;
1029 }
1030 break;
1031 }
1032 case find_ver_byte:
1033 {
1034 if (_debug)
1035 Serial.println("find_ver_byte");
1036
1037 if (recChar != dfplayer::VER)
1038 {
1039 if (_debug)
1040 Serial.println("ver error");
1041
1042 state = find_start_byte;
1043 return false;
1044 }
1045
1046 recStack.version = recChar;
1047 state = find_len_byte;
1048 break;
1049 }
1050 case find_len_byte:
1051 {
1052 if (_debug)
1053 Serial.println("find_len_byte");
1054
1055 if (recChar != dfplayer::LEN)
1056 {
1057 if (_debug)
1058 Serial.println("len error");
1059
1060 state = find_start_byte;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected