chore: Ignore edge cases for coverage
This commit is contained in:
parent
ae49d3037d
commit
b384278b29
34
src/MIDI.hpp
34
src/MIDI.hpp
|
|
@ -107,7 +107,7 @@ void MidiInterface<Transport, Settings, Platform>::begin(Channel inChannel)
|
||||||
|
|
||||||
/*! \brief Send a MIDI message.
|
/*! \brief Send a MIDI message.
|
||||||
\param inMessage The message
|
\param inMessage The message
|
||||||
|
|
||||||
This method is used when you want to send a Message that has not been constructed
|
This method is used when you want to send a Message that has not been constructed
|
||||||
by the library, but by an external source.
|
by the library, but by an external source.
|
||||||
This method does *not* check against any of the constraints.
|
This method does *not* check against any of the constraints.
|
||||||
|
|
@ -119,12 +119,12 @@ void MidiInterface<Transport, Settings, Platform>::send(const MidiMessage& inMes
|
||||||
{
|
{
|
||||||
if (!inMessage.valid)
|
if (!inMessage.valid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mTransport.beginTransmission(inMessage.type))
|
if (mTransport.beginTransmission(inMessage.type))
|
||||||
{
|
{
|
||||||
const StatusByte status = getStatus(inMessage.type, inMessage.channel);
|
const StatusByte status = getStatus(inMessage.type, inMessage.channel);
|
||||||
mTransport.write(status);
|
mTransport.write(status);
|
||||||
|
|
||||||
if (inMessage.type != MidiType::SystemExclusive)
|
if (inMessage.type != MidiType::SystemExclusive)
|
||||||
{
|
{
|
||||||
if (inMessage.length > 1) mTransport.write(inMessage.data1);
|
if (inMessage.length > 1) mTransport.write(inMessage.data1);
|
||||||
|
|
@ -726,7 +726,7 @@ inline bool MidiInterface<Transport, Settings, Platform>::read(Channel inChannel
|
||||||
sendActiveSensing();
|
sendActiveSensing();
|
||||||
mLastMessageSentTime = Platform::now();
|
mLastMessageSentTime = Platform::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings::UseReceiverActiveSensing && mReceiverActiveSensingActivated && (mLastMessageReceivedTime + ActiveSensingTimeout < Platform::now()))
|
if (Settings::UseReceiverActiveSensing && mReceiverActiveSensingActivated && (mLastMessageReceivedTime + ActiveSensingTimeout < Platform::now()))
|
||||||
{
|
{
|
||||||
mReceiverActiveSensingActivated = false;
|
mReceiverActiveSensingActivated = false;
|
||||||
|
|
@ -742,7 +742,7 @@ inline bool MidiInterface<Transport, Settings, Platform>::read(Channel inChannel
|
||||||
|
|
||||||
if (!parse())
|
if (!parse())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifndef RegionActiveSending
|
#ifndef RegionActiveSending
|
||||||
|
|
||||||
if (Settings::UseReceiverActiveSensing && mMessage.type == ActiveSensing)
|
if (Settings::UseReceiverActiveSensing && mMessage.type == ActiveSensing)
|
||||||
|
|
@ -881,13 +881,13 @@ bool MidiInterface<Transport, Settings, Platform>::parse()
|
||||||
mRunningStatus_RX = InvalidType;
|
mRunningStatus_RX = InvalidType;
|
||||||
mMessage.sysexArray[0] = pendingType;
|
mMessage.sysexArray[0] = pendingType;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InvalidType:
|
case InvalidType:
|
||||||
default:
|
default:
|
||||||
// This is obviously wrong. Let's get the hell out'a here.
|
// This is obviously wrong. Let's get the hell out'a here.
|
||||||
mLastError |= 1UL << ErrorParse; // set the ErrorParse bit
|
mLastError |= 1UL << ErrorParse; // set the ErrorParse bit
|
||||||
if (mErrorCallback)
|
if (mErrorCallback)
|
||||||
mErrorCallback(mLastError);
|
mErrorCallback(mLastError); // LCOV_EXCL_LINE
|
||||||
|
|
||||||
resetInput();
|
resetInput();
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -902,11 +902,11 @@ bool MidiInterface<Transport, Settings, Platform>::parse()
|
||||||
mMessage.data1 = mPendingMessage[1];
|
mMessage.data1 = mPendingMessage[1];
|
||||||
mMessage.data2 = 0; // Completed new message has 1 data byte
|
mMessage.data2 = 0; // Completed new message has 1 data byte
|
||||||
mMessage.length = 1;
|
mMessage.length = 1;
|
||||||
|
|
||||||
mPendingMessageIndex = 0;
|
mPendingMessageIndex = 0;
|
||||||
mPendingMessageExpectedLength = 0;
|
mPendingMessageExpectedLength = 0;
|
||||||
mMessage.valid = true;
|
mMessage.valid = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -947,7 +947,7 @@ bool MidiInterface<Transport, Settings, Platform>::parse()
|
||||||
mMessage.channel = 0;
|
mMessage.channel = 0;
|
||||||
mMessage.length = 1;
|
mMessage.length = 1;
|
||||||
mMessage.valid = true;
|
mMessage.valid = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Exclusive
|
// Exclusive
|
||||||
|
|
@ -968,7 +968,7 @@ bool MidiInterface<Transport, Settings, Platform>::parse()
|
||||||
mMessage.valid = true;
|
mMessage.valid = true;
|
||||||
|
|
||||||
resetInput();
|
resetInput();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -976,7 +976,7 @@ bool MidiInterface<Transport, Settings, Platform>::parse()
|
||||||
// Well well well.. error.
|
// Well well well.. error.
|
||||||
mLastError |= 1UL << ErrorParse; // set the error bits
|
mLastError |= 1UL << ErrorParse; // set the error bits
|
||||||
if (mErrorCallback)
|
if (mErrorCallback)
|
||||||
mErrorCallback(mLastError);
|
mErrorCallback(mLastError); // LCOV_EXCL_LINE
|
||||||
|
|
||||||
resetInput();
|
resetInput();
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1022,9 +1022,9 @@ bool MidiInterface<Transport, Settings, Platform>::parse()
|
||||||
|
|
||||||
mMessage.sysexArray[0] = SystemExclusiveEnd;
|
mMessage.sysexArray[0] = SystemExclusiveEnd;
|
||||||
mMessage.sysexArray[1] = lastByte;
|
mMessage.sysexArray[1] = lastByte;
|
||||||
|
|
||||||
mPendingMessageIndex = 2;
|
mPendingMessageIndex = 2;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1037,9 +1037,9 @@ bool MidiInterface<Transport, Settings, Platform>::parse()
|
||||||
|
|
||||||
mMessage.data1 = mPendingMessage[1];
|
mMessage.data1 = mPendingMessage[1];
|
||||||
// Save data2 only if applicable
|
// Save data2 only if applicable
|
||||||
mMessage.data2 = mPendingMessageExpectedLength == 3 ? mPendingMessage[2] : 0;
|
mMessage.data2 = mPendingMessageExpectedLength == 3 ? mPendingMessage[2] : 0;
|
||||||
mMessage.length = mPendingMessageExpectedLength;
|
mMessage.length = mPendingMessageExpectedLength;
|
||||||
|
|
||||||
// Reset local variables
|
// Reset local variables
|
||||||
mPendingMessageIndex = 0;
|
mPendingMessageIndex = 0;
|
||||||
mPendingMessageExpectedLength = 0;
|
mPendingMessageExpectedLength = 0;
|
||||||
|
|
@ -1224,7 +1224,7 @@ MidiType MidiInterface<Transport, Settings, Platform>::getTypeFromStatusByte(byt
|
||||||
(inStatus == Undefined_F5) ||
|
(inStatus == Undefined_F5) ||
|
||||||
(inStatus == Undefined_FD))
|
(inStatus == Undefined_FD))
|
||||||
return InvalidType; // Data bytes and undefined.
|
return InvalidType; // Data bytes and undefined.
|
||||||
|
|
||||||
if (inStatus < 0xf0)
|
if (inStatus < 0xf0)
|
||||||
// Channel message, remove channel nibble.
|
// Channel message, remove channel nibble.
|
||||||
return MidiType(inStatus & 0xf0);
|
return MidiType(inStatus & 0xf0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue