Skip to content

Commit b504877

Browse files
authored
Merge pull request #28 from pennam/redirect-errors
Redirect error prints to Serial
2 parents e54988f + 348300a commit b504877

5 files changed

+11
-13
lines changed

.github/workflows/compile-examples.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,17 @@ jobs:
3535
- fqbn: arduino:mbed:envie_m7
3636
platforms: |
3737
- name: arduino:mbed
38+
libraries: |
39+
- name: Arduino_DebugUtils
3840
sketch-paths: |
3941
- examples/OTA_Qspi_Flash
4042
- examples/OTA_SD_Portenta
4143
- examples/OTA_Usage_Portenta
4244
- fqbn: arduino:mbed_nicla:nicla_vision
4345
platforms: |
4446
- name: arduino:mbed_nicla
47+
libraries: |
48+
- name: Arduino_DebugUtils
4549
sketch-paths: |
4650
- examples/OTA_Qspi_Flash
4751
- examples/OTA_Usage_Portenta
@@ -59,8 +63,7 @@ jobs:
5963
libraries: |
6064
# Install the library from the local path.
6165
- source-path: ./
62-
# Additional library dependencies can be listed here.
63-
# See: https://github.com/arduino/compile-sketches#libraries
66+
${{ matrix.board.libraries }}
6467
sketch-paths: |
6568
${{ matrix.board.sketch-paths }}
6669
enable-deltas-report: true

src/Arduino_Portenta_OTA.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ bool Arduino_Portenta_OTA::isOtaCapable()
6464

6565
Arduino_Portenta_OTA::Error Arduino_Portenta_OTA::begin()
6666
{
67-
Serial1.begin(115200);
68-
6967
if (!isOtaCapable())
7068
return Error::NoCapableBootloader;
7169

src/Arduino_Portenta_OTA.h

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <MBRBlockDevice.h>
3636
#include <FATFileSystem.h>
3737
#include <LittleFileSystem.h>
38+
#include <Arduino_DebugUtils.h>
3839

3940
/******************************************************************************
4041
* DEFINE

src/Arduino_Portenta_OTA_QSPI.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bool Arduino_Portenta_OTA_QSPI::init()
4848
{
4949
_bd_raw_qspi = mbed::BlockDevice::get_default_instance();
5050
if (_bd_raw_qspi->init() != QSPIF_BD_ERROR_OK) {
51-
Serial1.println("Error: QSPI init failure.");
51+
Debug.print(DBG_ERROR, F("Error: QSPI init failure."));
5252
return false;
5353
}
5454

@@ -58,8 +58,7 @@ bool Arduino_Portenta_OTA_QSPI::init()
5858
int const err_mount = _fs_qspi->mount(_bd_raw_qspi);
5959
if (err_mount)
6060
{
61-
Serial1.print("Error while mounting the filesystem. Err = ");
62-
Serial1.println(err_mount);
61+
Debug.print(DBG_ERROR, F("Error while mounting the filesystem. Err = %d"), err_mount);
6362
return false;
6463
}
6564
return true;
@@ -71,8 +70,7 @@ bool Arduino_Portenta_OTA_QSPI::init()
7170
_fs_qspi = new mbed::FATFileSystem("fs");
7271
int const err_mount = _fs_qspi->mount(_bd_qspi);
7372
if (err_mount) {
74-
Serial1.print("Error while mounting the filesystem. Err = ");
75-
Serial1.println(err_mount);
73+
Debug.print(DBG_ERROR, F("Error while mounting the filesystem. Err = %d"), err_mount);
7674
return false;
7775
}
7876
return true;

src/Arduino_Portenta_OTA_SD.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ bool Arduino_Portenta_OTA_SD::init()
6161
_fs_sd = new mbed::FATFileSystem("fs");
6262
int const err = _fs_sd->mount(&_block_device);
6363
if (err) {
64-
Serial1.print("Error while mounting the filesystem. Err = ");
65-
Serial1.println(err);
64+
Debug.print(DBG_ERROR, F("Error while mounting the filesystem. Err = %d"), err);
6665
return false;
6766
}
6867
return true;
@@ -75,8 +74,7 @@ bool Arduino_Portenta_OTA_SD::init()
7574
int const err = _fs_sd->mount(_bd);
7675
if (err)
7776
{
78-
Serial1.print("Error while mounting the filesystem. Err = ");
79-
Serial1.println(err);
77+
Debug.print(DBG_ERROR, F("Error while mounting the filesystem. Err = %d"), err);
8078
return false;
8179
}
8280
return true;

0 commit comments

Comments
 (0)