minor improvements

This commit is contained in:
rusefi 2017-06-03 22:27:05 -04:00
parent e6e75ab888
commit 382f28daf1
2 changed files with 8 additions and 7 deletions

View File

@ -432,6 +432,7 @@ static void printInfo(systime_t nowSeconds) {
static systime_t timeOfPreviousReport = (systime_t) -1; static systime_t timeOfPreviousReport = (systime_t) -1;
extern fatal_msg_t errorMessageBuffer; extern fatal_msg_t errorMessageBuffer;
extern bool consoleInBinaryMode;
/** /**
* @brief Sends all pending data to dev console * @brief Sends all pending data to dev console
@ -442,7 +443,9 @@ void updateDevConsoleState(void) {
} }
// looks like this is not needed anymore // looks like this is not needed anymore
// checkIfShouldHalt(); // checkIfShouldHalt();
if (!consoleInBinaryMode) {
printPending(); printPending();
}
/** /**
* this should go before the firmware error so that console can detect connection * this should go before the firmware error so that console can detect connection

View File

@ -73,7 +73,7 @@ char * swapOutputBuffers(int *actualOutputBufferSize) {
int expectedOutputSize; int expectedOutputSize;
#endif /* EFI_ENABLE_ASSERTS */ #endif /* EFI_ENABLE_ASSERTS */
{ // start of critical section { // start of critical section
lockOutputBuffer(); bool alreadyLocked = lockOutputBuffer();
/** /**
* we cannot output under syslock, we simply rotate which buffer is which * we cannot output under syslock, we simply rotate which buffer is which
*/ */
@ -88,7 +88,9 @@ char * swapOutputBuffers(int *actualOutputBufferSize) {
accumulatedSize = 0; accumulatedSize = 0;
accumulationBuffer[0] = 0; accumulationBuffer[0] = 0;
if (!alreadyLocked) {
unlockOutputBuffer(); unlockOutputBuffer();
}
} // end of critical section } // end of critical section
*actualOutputBufferSize = efiStrlen(outputBuffer); *actualOutputBufferSize = efiStrlen(outputBuffer);
@ -104,16 +106,12 @@ char * swapOutputBuffers(int *actualOutputBufferSize) {
return outputBuffer; return outputBuffer;
} }
extern bool consoleInBinaryMode;
/** /**
* This method actually sends all the pending data to the communication layer. * This method actually sends all the pending data to the communication layer.
* This method is invoked by the main thread - that's the only thread which should be sending * This method is invoked by the main thread - that's the only thread which should be sending
* actual data to console in order to avoid concurrent access to serial hardware. * actual data to console in order to avoid concurrent access to serial hardware.
*/ */
void printPending(void) { void printPending(void) {
if (consoleInBinaryMode)
return;
int actualOutputBufferSize; int actualOutputBufferSize;
char *output = swapOutputBuffers(&actualOutputBufferSize); char *output = swapOutputBuffers(&actualOutputBufferSize);