MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / THROWS

Function THROWS

src/Platform/Platform.cpp:1497–1642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1495}
1496
1497GCodeResult Platform::PrintTestReport(GCodeBuffer& gb, const StringRef& reply, OutputBuffer *_ecv_null & buf) const THROWS(GCodeException)
1498{
1499 if (!OutputBuffer::Allocate(buf))
1500 {
1501 reply.copy("No output buffer");
1502 return GCodeResult::error;
1503 }
1504
1505 bool testFailed = false;
1506
1507#if HAS_MASS_STORAGE
1508# if HAS_HIGH_SPEED_SD
1509 uint32_t speed;
1510# endif
1511 // Check the SD card detect and speed
1512 if (!MassStorage::IsCardDetected(0))
1513 {
1514 buf->copy("SD card 0 not detected");
1515 testFailed = true;
1516 }
1517# if HAS_HIGH_SPEED_SD
1518 else if ((speed = sd_mmc_get_interface_speed(0, nullptr)) != ExpectedSdCardSpeed)
1519 {
1520 buf->printf("SD card speed %.2fMbytes/sec is unexpected", (double)((float)speed * 0.000001));
1521 testFailed = true;
1522 }
1523# endif
1524 else
1525 {
1526 buf->copy("SD card interface OK");
1527 }
1528#endif
1529
1530#if HAS_CPU_TEMP_SENSOR
1531 // Check the MCU temperature
1532 {
1533 gb.MustSee('T');
1534 float tempMinMax[2];
1535 size_t numTemps = 2;
1536 gb.GetFloatArray(tempMinMax, numTemps, false);
1537 const float currentMcuTemperature = GetCpuTemperature();
1538 if (currentMcuTemperature < tempMinMax[0])
1539 {
1540 buf->lcatf("MCU temperature %.1f is lower than expected", (double)currentMcuTemperature);
1541 testFailed = true;
1542 }
1543 else if (currentMcuTemperature > tempMinMax[1])
1544 {
1545 buf->lcatf("MCU temperature %.1f is higher than expected", (double)currentMcuTemperature);
1546 testFailed = true;
1547 }
1548 else
1549 {
1550 buf->lcat("MCU temperature reading OK");
1551 }
1552 }
1553#endif
1554

Callers

nothing calls this directly

Calls 15

AdcReadingToPowerVoltageFunction · 0.85
AdcReadingToV12VoltageFunction · 0.85
TransferFunction · 0.85
ConvertHexToAsciiHexFunction · 0.85
copyMethod · 0.80
lcatfMethod · 0.80
lcatMethod · 0.80
GetNumSmartDriversMethod · 0.80
AppendCharsToBufferMethod · 0.80
GetBlockNestingMethod · 0.80

Tested by

no test coverage detected