fix serial build error

This commit is contained in:
Forairaaaaa
2026-04-15 14:05:18 +08:00
parent cd12f67cd6
commit 0b21426f71
2 changed files with 15 additions and 15 deletions
+10 -10
View File
@@ -35,7 +35,7 @@ decode_results results;
void setup()
{
M5StackChan.begin();
USBSerial.begin(115200);
Serial.begin(115200);
// Perform a low level sanity checks that the compiler performs bit field
// packing as we expect and Endianness is as we expect.
@@ -55,23 +55,23 @@ void loop()
if (irrecv.decode(&results)) {
// Display a crude timestamp.
uint32_t now = millis();
USBSerial.printf(D_STR_TIMESTAMP " : %06u.%03u\n", now / 1000, now % 1000);
Serial.printf(D_STR_TIMESTAMP " : %06u.%03u\n", now / 1000, now % 1000);
// Check if we got an IR message that was to big for our capture buffer.
if (results.overflow) USBSerial.printf(D_WARN_BUFFERFULL "\n", kCaptureBufferSize);
if (results.overflow) Serial.printf(D_WARN_BUFFERFULL "\n", kCaptureBufferSize);
// Display the library version the message was captured with.
USBSerial.println(D_STR_LIBRARY " : v" _IRREMOTEESP8266_VERSION_STR "\n");
Serial.println(D_STR_LIBRARY " : v" _IRREMOTEESP8266_VERSION_STR "\n");
// Display the tolerance percentage if it has been change from the default.
if (kTolerancePercentage != kTolerance) USBSerial.printf(D_STR_TOLERANCE " : %d%%\n", kTolerancePercentage);
if (kTolerancePercentage != kTolerance) Serial.printf(D_STR_TOLERANCE " : %d%%\n", kTolerancePercentage);
// Display the basic output of what we found.
USBSerial.print(resultToHumanReadableBasic(&results));
Serial.print(resultToHumanReadableBasic(&results));
// Display any extra A/C info if we have it.
String description = IRAcUtils::resultAcToString(&results);
if (description.length()) USBSerial.println(D_STR_MESGDESC ": " + description);
if (description.length()) Serial.println(D_STR_MESGDESC ": " + description);
yield(); // Feed the WDT as the text output can take a while to print.
// Output the results as source code
USBSerial.println(resultToSourceCode(&results));
USBSerial.println(); // Blank line between entries
yield(); // Feed the WDT (again)
Serial.println(resultToSourceCode(&results));
Serial.println(); // Blank line between entries
yield(); // Feed the WDT (again)
}
delay(50);
}
+5 -5
View File
@@ -26,22 +26,22 @@ uint8_t samsungState[kSamsungAcStateLength] = {0x02, 0x92, 0x0F, 0x00, 0x00, 0x0
void setup()
{
M5StackChan.begin();
USBSerial.begin(115200);
Serial.begin(115200);
irsend.begin();
}
void loop()
{
USBSerial.println("NEC");
Serial.println("NEC");
irsend.sendNEC(0x00FFE01FUL);
delay(2000);
USBSerial.println("Sony");
Serial.println("Sony");
irsend.sendSony(0xa90, 12, 2); // 12 bits & 2 repeats
delay(2000);
USBSerial.println("a rawData capture from IRrecvDumpV2");
Serial.println("a rawData capture from IRrecvDumpV2");
irsend.sendRaw(rawData, 67, 38); // Send a raw data capture at 38kHz.
delay(2000);
USBSerial.println("a Samsung A/C state from IRrecvDumpV2");
Serial.println("a Samsung A/C state from IRrecvDumpV2");
irsend.sendSamsungAC(samsungState);
delay(2000);
}