Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(PlatformIO): use arduino-esp32 3.0.0 #120

Merged
merged 9 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
paths-ignore:
- "**/*.md"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-bhaptics:
name: Build ${{ matrix.target }} ${{ matrix.coverage && 'with coverage' || 'without coverage' }}, -D ${{ matrix.battery_flag }} -D ${{ matrix.nimble_flag }}
Expand Down Expand Up @@ -131,7 +135,7 @@ jobs:
- name: Change memory segments
if: matrix.coverage
run: |
sed -i "s/len\s=\s0x2c200\s-\s0xdb5c/len = 2898880/" ~/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/memory.ld
sed -i "s/len\s=\s0x2c200\s-\s0xdb5c/len = 2898880/" ~/.platformio/packages/framework-arduinoespressif32-libs/esp32/ld/memory.ld
sed -i "/\[env\]/p; s/\[env\]/board_build.partitions = huge_app.csv/" platformio.ini

- name: Build
Expand Down Expand Up @@ -271,7 +275,7 @@ jobs:
- name: Change memory segments
if: matrix.coverage
run: |
sed -i "s/len\s=\s0x2c200\s-\s0xdb5c/len = 2898880/" ~/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/memory.ld
sed -i "s/len\s=\s0x2c200\s-\s0xdb5c/len = 2898880/" ~/.platformio/packages/framework-arduinoespressif32-libs/esp32/ld/memory.ld
sed -i "/\[env\]/p; s/\[env\]/board_build.partitions = huge_app.csv/" platformio.ini

- name: Build
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
schedule:
- cron: '0 16 * * 6'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
paths-ignore:
- '**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
clang-format:
name: clang-format - `${{ matrix.path }}`
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
paths:
- '.github/workflows/release.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-bhaptics:
runs-on: ubuntu-latest
Expand Down
5 changes: 3 additions & 2 deletions .wokwi/lucidgloves-prototype4+serial/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ version: 1
author: Leonid Meleshin

steps:
- delay: 2000ms
- delay: 3000ms

# Press calibration button
- set-control:
part-id: btn3
control: pressed
value: 1

- delay: 250ms
- delay: 500ms

# Release calibration button
- set-control:
part-id: btn3
control: pressed
Expand Down
5 changes: 3 additions & 2 deletions ini/bhaptics.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[bhaptics]
platform = platformio/espressif32@^6.1.0
platform = platformio/espressif32@^6.7.0
platform_packages =
platformio/framework-arduinoespressif32@^3.20014.231204
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
framework = arduino
board = esp32doit-devkit-v1
upload_speed = 921600
Expand Down
5 changes: 3 additions & 2 deletions ini/opengloves.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[opengloves]
platform = platformio/espressif32@^6.1.0
platform = platformio/espressif32@^6.7.0
platform_packages =
platformio/framework-arduinoespressif32@^3.20014.231204
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
framework = arduino
board = esp32doit-devkit-v1
upload_speed = 921600
Expand Down
2 changes: 1 addition & 1 deletion lib/arduino/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"adafruit/Adafruit PWM Servo Driver Library": "^2.4.0",
"adafruit/Adafruit INA219": "^1.2.1",
"sparkfun/SparkFun MAX1704x Fuel Gauge Arduino Library": "^1.0.4",
"madhephaestus/ESP32Servo": "^1.1.2"
"madhephaestus/ESP32Servo": "^3.0.0"
}
}
16 changes: 5 additions & 11 deletions lib/arduino_esp32/senseshift/arduino/output/ledc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
{
}

~LedcOutput() override { ledcDetach(this->pin_); }

Check warning on line 23 in lib/arduino_esp32/senseshift/arduino/output/ledc.hpp

View check run for this annotation

Codecov / codecov/patch

lib/arduino_esp32/senseshift/arduino/output/ledc.hpp#L23

Added line #L23 was not covered by tests

void init() override
{
pinMode(this->pin_, OUTPUT);
this->channel_ = findChannel(this->pin_);

LOG_D(TAG, "GPIO %d - Setting up Channel %d", this->pin_, this->channel_);
if (ledcSetup(this->channel_, this->analog_frequency_, this->analog_resolution_) == 0) {
if (!ledcAttach(this->pin_, this->analog_frequency_, this->analog_resolution_)) {

Check warning on line 30 in lib/arduino_esp32/senseshift/arduino/output/ledc.hpp

View check run for this annotation

Codecov / codecov/patch

lib/arduino_esp32/senseshift/arduino/output/ledc.hpp#L30

Added line #L30 was not covered by tests
LOG_E(
TAG,
"setup failed (freq = %u, resolution = %u). Try setting different resolution or frequency",
Expand All @@ -35,26 +36,19 @@
);
return;
}
ledcAttachPin(this->pin_, this->channel_);
}

[[nodiscard]] auto getMaxValue() const -> std::uint32_t { return (1 << analog_resolution_) - 1; }
[[nodiscard]] inline auto getMaxValue() const -> std::uint32_t { return (1 << this->analog_resolution_) - 1; }

Check warning on line 41 in lib/arduino_esp32/senseshift/arduino/output/ledc.hpp

View check run for this annotation

Codecov / codecov/patch

lib/arduino_esp32/senseshift/arduino/output/ledc.hpp#L41

Added line #L41 was not covered by tests

void writeState(const float value) override
{
const auto duty = static_cast<std::uint32_t>(value * this->getMaxValue());
LOG_V(TAG, "GPIO %d - Writing %d to Channel %d", this->pin_, duty, this->channel_);
ledcWrite(this->channel_, duty);
ledcWrite(this->pin_, duty);

Check warning on line 47 in lib/arduino_esp32/senseshift/arduino/output/ledc.hpp

View check run for this annotation

Codecov / codecov/patch

lib/arduino_esp32/senseshift/arduino/output/ledc.hpp#L47

Added line #L47 was not covered by tests
};

protected:
static auto findChannel(std::uint8_t /*pin*/) -> std::int8_t { return CHANNELS++; }

private:
static inline std::uint8_t CHANNELS = 0;

std::uint8_t pin_;
std::int8_t channel_ = -1;
std::uint8_t analog_resolution_;
std::uint32_t analog_frequency_;
};
Expand Down
5 changes: 3 additions & 2 deletions lib/bhaptics_ble/senseshift/bh/ble/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@

void onWrite(BLECharacteristic* pCharacteristic) override
{
std::string value = pCharacteristic->getValue();
auto value = pCharacteristic->getValue();
std::string valueStr(value.begin(), value.end());

Check warning on line 107 in lib/bhaptics_ble/senseshift/bh/ble/connection.cpp

View check run for this annotation

Codecov / codecov/patch

lib/bhaptics_ble/senseshift/bh/ble/connection.cpp#L106-L107

Added lines #L106 - L107 were not covered by tests

this->motorTransformer(value);
this->motorTransformer(valueStr);

Check warning on line 109 in lib/bhaptics_ble/senseshift/bh/ble/connection.cpp

View check run for this annotation

Codecov / codecov/patch

lib/bhaptics_ble/senseshift/bh/ble/connection.cpp#L109

Added line #L109 was not covered by tests
};
};

Expand Down
4 changes: 4 additions & 0 deletions lib/bhaptics_ble/senseshift/bh/ble/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ namespace SenseShift::BH::BLE {
struct ConnectionConfig {
static constexpr size_t SN_LENGTH = 10;

#if defined(SS_BLE_USE_NIMBLE) && SS_BLE_USE_NIMBLE == true
std::string deviceName;
#else
String deviceName;
#endif
uint16_t appearance;
uint8_t serialNumber[SN_LENGTH];
};
Expand Down
2 changes: 1 addition & 1 deletion lib/ble_serial/BLESerial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
return;
}

std::string rxValue = pCharacteristic->getValue();
auto rxValue = pCharacteristic->getValue();

Check warning on line 240 in lib/ble_serial/BLESerial.hpp

View check run for this annotation

Codecov / codecov/patch

lib/ble_serial/BLESerial.hpp#L240

Added line #L240 was not covered by tests
for (int i = 0; i < rxValue.length(); i++) {
bleSerial->m_receiveBuffer.push(rxValue[i]);
}
Expand Down
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build_flags =
; -D DEBUG_ESP_PORT=Serial
; -D SS_BATTERY_ENABLED=true
; -D SS_BLE_USE_NIMBLE=true
-D SOC_WIFI_SUPPORTED=1

build_src_filter =
+<*>
Expand Down
Loading