In void DFRobotDFPlayerMini::parseStack() the media online reporting code is
case 0x3F: if (_handleParameter & 0x01) { handleMessage(DFPlayerUSBOnline, _handleParameter); } else if (_handleParameter & 0x02) { handleMessage(DFPlayerCardOnline, _handleParameter); } else if (_handleParameter & 0x03) { handleMessage(DFPlayerCardUSBOnline, _handleParameter); } break;
If a USB and SD are both online the last else if is unreachable because of the bitwise & testing. Currently it would only report the USB as online.
I think each test should be if (_handleParameter == 0x0?) where ? is 1, 2 or 3.
I thought about reversing the order of tests, putting if (_handleParameter == 0x03) first. But that would return non zero i.e. true if either or both USB and/or SD were online.
I leave the matter for your review; I suspect very few users employ both USB and SD so the library has worked for us.
Thanks.
In
void DFRobotDFPlayerMini::parseStack()the media online reporting code iscase 0x3F: if (_handleParameter & 0x01) { handleMessage(DFPlayerUSBOnline, _handleParameter); } else if (_handleParameter & 0x02) { handleMessage(DFPlayerCardOnline, _handleParameter); } else if (_handleParameter & 0x03) { handleMessage(DFPlayerCardUSBOnline, _handleParameter); } break;If a USB and SD are both online the last
else ifis unreachable because of the bitwise&testing. Currently it would only report the USB as online.I think each test should be
if (_handleParameter == 0x0?)where ? is 1, 2 or 3.I thought about reversing the order of tests, putting
if (_handleParameter == 0x03)first. But that would return non zero i.e. true if either or both USB and/or SD were online.I leave the matter for your review; I suspect very few users employ both USB and SD so the library has worked for us.
Thanks.