Skip to content

Commit

Permalink
Merge pull request #282 from brentru/fix-build-esp32-bsp
Browse files Browse the repository at this point in the history
Fix WipperSnapper GCC bugs for ESP32-2.0.4
  • Loading branch information
brentru authored Jul 11, 2022
2 parents 229ec98 + ce00da2 commit 6b1c508
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-clang-doxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ jobs:
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
- uses: actions/checkout@v2
with:
repository: adafruit/ci-arduino
repository: brentru/ci-arduino
path: ci
- name: Install CI-Arduino
run: bash ci/actions_install.sh
- name: Install extra Arduino libraries
run: |
git clone --quiet https://github.com/brentru/Adafruit_MQTT_Library.git /home/runner/Arduino/libraries/Adafruit_MQTT_Library
- name: Build for ESP32-Sx
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --no_warn
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}
- name: list
run : |
ls
Expand Down
1 change: 1 addition & 0 deletions src/Wippersnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void Wippersnapper::set_ssid_pass() {
@brief Configures the device's Adafruit IO credentials. This method
should be used only if filesystem-backed provisioning is
not avaliable.
*/
/****************************************************************************/
void Wippersnapper::set_user_key() {
WS_DEBUG_PRINTLN("ERROR: Please define a network interface!");
Expand Down
3 changes: 2 additions & 1 deletion src/components/i2c/WipperSnapper_I2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ void WipperSnapper_Component_I2C::deinitI2CDevice(
for (iter = drivers.begin(), end = drivers.end(); iter != end; ++iter) {
if ((*iter)->getI2CAddress() == deviceAddr) {
// Delete the object that iter points to
delete *iter;
// delete *iter;
*iter = nullptr;
// ESP-IDF, Erase–remove iter ptr from driver vector
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
*iter = nullptr;
Expand Down
4 changes: 3 additions & 1 deletion src/components/i2c/drivers/WipperSnapper_I2C_Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class WipperSnapper_I2C_Driver {
/*******************************************************************************/
WipperSnapper_I2C_Driver(TwoWire *i2c, uint16_t sensorAddress) {
_i2c = i2c;
_sensorAddress;
_sensorAddress = sensorAddress;
}

/*******************************************************************************/
Expand Down Expand Up @@ -104,10 +104,12 @@ class WipperSnapper_I2C_Driver {
enableSensorObjectTemp();
setSensorObjectTempPeriod(
msgDeviceInitReq->i2c_device_properties[propertyIdx].sensor_period);
break;
case wippersnapper_i2c_v1_SensorType_SENSOR_TYPE_LIGHT:
enableSensorLight();
setSensorLightPeriod(
msgDeviceInitReq->i2c_device_properties[propertyIdx].sensor_period);
break;
default:
break;
}
Expand Down
25 changes: 9 additions & 16 deletions src/components/i2c/drivers/WipperSnapper_I2C_Driver_SCD30.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,15 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
_sensorAddress = sensorAddress;
}

/*******************************************************************************/
/*!
@brief Destructor for an SCD30 sensor.
*/
/*******************************************************************************/
~WipperSnapper_I2C_Driver_SCD30() { delete _scd30; }

/*******************************************************************************/
/*!
@brief Initializes the SCD30 sensor and begins I2C.
@returns True if initialized successfully, False otherwise.
*/
/*******************************************************************************/
bool begin() {
_scd30 = new Adafruit_SCD30();
bool isInit = _scd30->begin((uint8_t)_sensorAddress, _i2c);
_scd = new Adafruit_SCD30();
bool isInit = _scd->begin((uint8_t)_sensorAddress, _i2c);
return isInit;
}

Expand All @@ -72,12 +65,12 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
/*******************************************************************************/
bool getEventAmbientTemperature(sensors_event_t *tempEvent) {
// check if sensor is enabled and data is available
if (_tempSensorPeriod != 0 && (!_scd30->dataReady()))
if (_tempSensorPeriod != 0 && (!_scd->dataReady()))
return false;

// attempt to get temperature data
sensors_event_t humidEvent;
if (!_scd30->getEvent(&humidEvent, tempEvent))
if (!_scd->getEvent(&humidEvent, tempEvent))
return false;

return true;
Expand All @@ -94,12 +87,12 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
/*******************************************************************************/
bool getEventRelativeHumidity(sensors_event_t *humidEvent) {
// check if sensor is enabled and data is available
if (_humidSensorPeriod != 0 && (!_scd30->dataReady()))
if (_humidSensorPeriod != 0 && (!_scd->dataReady()))
return false;

// attempt to get temperature data
sensors_event_t tempEvent;
if (!_scd30->getEvent(humidEvent, &tempEvent))
if (!_scd->getEvent(humidEvent, &tempEvent))
return false;

return true;
Expand All @@ -116,16 +109,16 @@ class WipperSnapper_I2C_Driver_SCD30 : public WipperSnapper_I2C_Driver {
/*******************************************************************************/
bool getEventCO2(sensors_event_t *co2Event) {
// check if sensor is enabled and data is available
if (_CO2SensorPeriod != 0 && (!_scd30->dataReady()))
if (_CO2SensorPeriod != 0 && (!_scd->dataReady()))
return false;
// TODO: This is a TEMPORARY HACK, we need to add CO2 type to
// adafruit_sensor
co2Event->data[0] = _scd30->CO2;
co2Event->data[0] = _scd->CO2;
return true;
}

protected:
Adafruit_SCD30 *_scd30; ///< SCD30 driver object
Adafruit_SCD30 *_scd; ///< SCD30 driver object
};

#endif // WipperSnapper_I2C_Driver_SCD30
4 changes: 2 additions & 2 deletions src/provisioning/tinyusb/Wippersnapper_FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ void Wippersnapper_FS::parseSecrets() {
}

// error check if SSID is the from templated json
if (WS._network_ssid == "YOUR_WIFI_SSID_HERE") {
if (strcmp(WS._network_ssid, "YOUR_WIFI_SSID_HERE") == 0) {
writeToBootOut(
"* ERROR: Default SSID found in secrets.json, please edit "
"the secrets.json file and reset the board for the changes to take "
Expand Down Expand Up @@ -447,7 +447,7 @@ void Wippersnapper_FS::parseSecrets() {
fsHalt();
}
// error check if wifi password is from template
if (WS._network_pass == "YOUR_WIFI_PASS_HERE") {
if (strcmp(WS._network_pass, "YOUR_WIFI_PASS_HERE") == 0) {
writeToBootOut("Default SSID found in secrets.json, please edit "
"the secrets.json file and reset the board\n");
fsHalt();
Expand Down

0 comments on commit 6b1c508

Please sign in to comment.