diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index 4e60accd..7d8e3487 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -18,3 +18,5 @@ lib_deps = lib_ignore = segger_rtt ESP32 BLE Arduino + +monitor_filters = esp32_exception_decoder diff --git a/firmware/variants/bhaptics/bhaptics.ini b/firmware/variants/bhaptics/bhaptics.ini index c8796192..dc4d7d57 100644 --- a/firmware/variants/bhaptics/bhaptics.ini +++ b/firmware/variants/bhaptics/bhaptics.ini @@ -1,4 +1,6 @@ [base:bhaptics] +extends = arch:esp32 + platform = ${arch:esp32.platform} platform_packages = ${arch:esp32.platform_packages} diff --git a/firmware/variants/bhaptics/tactal/tactal.cpp b/firmware/variants/bhaptics/tactal/tactal.cpp index fcd88e78..622d2fea 100644 --- a/firmware/variants/bhaptics/tactal/tactal.cpp +++ b/firmware/variants/bhaptics/tactal/tactal.cpp @@ -29,15 +29,15 @@ Application* app = &App; static const std::array bhLayout = { BH_LAYOUT_TACTAL }; +// Configure PWM pins to their positions on the face +const auto faceOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25), new LedcOutput(26), new LedcOutput(27), new LedcOutput(14) }, + // clang-format on +}); + void setup() { - // Configure PWM pins to their positions on the face - const auto faceOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25), new LedcOutput(26), new LedcOutput(27), new LedcOutput(14) }, - // clang-format on - }); - app->getVibroBody()->addTarget(Target::FaceFront, new FloatPlane(faceOutputs)); app->getVibroBody()->setup(); diff --git a/firmware/variants/bhaptics/tactosy2/tactosy2.cpp b/firmware/variants/bhaptics/tactosy2/tactosy2.cpp index 84c5b31e..caded197 100644 --- a/firmware/variants/bhaptics/tactosy2/tactosy2.cpp +++ b/firmware/variants/bhaptics/tactosy2/tactosy2.cpp @@ -29,16 +29,16 @@ Application* app = &App; static const std::array bhLayout = { BH_LAYOUT_TACTOSY2 }; +// Configure PWM pins to their positions on the forearm +auto forearmOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25) }, + { new LedcOutput(26), new LedcOutput(27), new LedcOutput(14) }, + // clang-format on +}); + void setup() { - // Configure PWM pins to their positions on the forearm - auto forearmOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25) }, - { new LedcOutput(26), new LedcOutput(27), new LedcOutput(14) }, - // clang-format on - }); - app->getVibroBody()->addTarget(Target::Accessory, new FloatPlane(forearmOutputs)); app->getVibroBody()->setup(); diff --git a/firmware/variants/bhaptics/tactosyf/tactosyf.cpp b/firmware/variants/bhaptics/tactosyf/tactosyf.cpp index 2e5c28c1..49a2a231 100644 --- a/firmware/variants/bhaptics/tactosyf/tactosyf.cpp +++ b/firmware/variants/bhaptics/tactosyf/tactosyf.cpp @@ -29,17 +29,17 @@ Application* app = &App; static const std::array bhLayout = { BH_LAYOUT_TACTOSYF }; +// Configure PWM pins to their positions on the feet +auto footOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new LedcOutput(32) }, + { new LedcOutput(33) }, + { new LedcOutput(25) }, + // clang-format on +}); + void setup() { - // Configure PWM pins to their positions on the feet - auto footOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new LedcOutput(32) }, - { new LedcOutput(33) }, - { new LedcOutput(25) }, - // clang-format on - }); - app->getVibroBody()->addTarget(Target::Accessory, new FloatPlane(footOutputs)); app->getVibroBody()->setup(); diff --git a/firmware/variants/bhaptics/tactosyh/tactosyh.cpp b/firmware/variants/bhaptics/tactosyh/tactosyh.cpp index 511c10fc..c2559262 100644 --- a/firmware/variants/bhaptics/tactosyh/tactosyh.cpp +++ b/firmware/variants/bhaptics/tactosyh/tactosyh.cpp @@ -29,17 +29,17 @@ Application* app = &App; static const std::array bhLayout = { BH_LAYOUT_TACTOSYH }; +// Configure PWM pins to their positions on the hands +auto handOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new LedcOutput(32) }, + { new LedcOutput(33) }, + { new LedcOutput(25) } + // clang-format on +}); + void setup() { - // Configure PWM pins to their positions on the hands - auto handOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new LedcOutput(32) }, - { new LedcOutput(33) }, - { new LedcOutput(25) } - // clang-format on - }); - app->getVibroBody()->addTarget(Target::Accessory, new FloatPlane(handOutputs)); app->getVibroBody()->setup(); diff --git a/firmware/variants/bhaptics/tactsuit_x16/tactsuit_x16.cpp b/firmware/variants/bhaptics/tactsuit_x16/tactsuit_x16.cpp index 003a391f..5f1fdb44 100644 --- a/firmware/variants/bhaptics/tactsuit_x16/tactsuit_x16.cpp +++ b/firmware/variants/bhaptics/tactsuit_x16/tactsuit_x16.cpp @@ -32,22 +32,22 @@ static const std::array bhLayout = { B // Ouput indices, responsible for x40 => x16 grouping static const std::array layoutGroups = BH_LAYOUT_TACTSUITX16_GROUPS; +// Configure PWM pins to their positions on the vest +auto frontOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25), new LedcOutput(26) }, + { new LedcOutput(27), new LedcOutput(14), new LedcOutput(12), new LedcOutput(13) }, + // clang-format on +}); +auto backOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new LedcOutput(19), new LedcOutput(18), new LedcOutput(5), new LedcOutput(17) }, + { new LedcOutput(16), new LedcOutput(4), new LedcOutput(2), new LedcOutput(15) }, + // clang-format on +}); + void setup() { - // Configure PWM pins to their positions on the vest - auto frontOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25), new LedcOutput(26) }, - { new LedcOutput(27), new LedcOutput(14), new LedcOutput(12), new LedcOutput(13) }, - // clang-format on - }); - auto backOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new LedcOutput(19), new LedcOutput(18), new LedcOutput(5), new LedcOutput(17) }, - { new LedcOutput(16), new LedcOutput(4), new LedcOutput(2), new LedcOutput(15) }, - // clang-format on - }); - app->getVibroBody()->addTarget(Target::ChestFront, new FloatPlane(frontOutputs)); app->getVibroBody()->addTarget(Target::ChestBack, new FloatPlane(backOutputs)); diff --git a/firmware/variants/bhaptics/tactsuit_x16_pca9685/tactsuit_x16_pca9685.cpp b/firmware/variants/bhaptics/tactsuit_x16_pca9685/tactsuit_x16_pca9685.cpp index 12d47bb0..433d4611 100644 --- a/firmware/variants/bhaptics/tactsuit_x16_pca9685/tactsuit_x16_pca9685.cpp +++ b/firmware/variants/bhaptics/tactsuit_x16_pca9685/tactsuit_x16_pca9685.cpp @@ -35,12 +35,27 @@ static const std::array bhLayout = { B // Ouput indices, responsible for x40 => x16 grouping static const std::array layoutGroups = BH_LAYOUT_TACTSUITX16_GROUPS; +auto pwm = i2cdev::PCA9685(0x40, I2CDev); + +// Assign the pins on the configured PCA9685 to positions on the vest +auto frontOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new PCA9685Output(pwm, 0), new PCA9685Output(pwm, 1), new PCA9685Output(pwm, 2), new PCA9685Output(pwm, 3) }, + { new PCA9685Output(pwm, 4), new PCA9685Output(pwm, 5), new PCA9685Output(pwm, 6), new PCA9685Output(pwm, 7) }, + // clang-format on +}); +auto backOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new PCA9685Output(pwm, 8), new PCA9685Output(pwm, 9), new PCA9685Output(pwm, 10), new PCA9685Output(pwm, 11) }, + { new PCA9685Output(pwm, 12), new PCA9685Output(pwm, 13), new PCA9685Output(pwm, 14), new PCA9685Output(pwm, 15) }, + // clang-format on +}); + void setup() { Wire.begin(); // Configure the PCA9685s - auto pwm = i2cdev::PCA9685(0x40, I2CDev); if (pwm.setFrequency(PWM_FREQUENCY) != I2CDEV_RESULT_OK) { LOG_E("pca9685", "Failed to set frequency"); } @@ -48,20 +63,6 @@ void setup() LOG_E("pca9685", "Failed to wake up"); } - // Assign the pins on the configured PCA9685 to positions on the vest - auto frontOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new PCA9685Output(pwm, 0), new PCA9685Output(pwm, 1), new PCA9685Output(pwm, 2), new PCA9685Output(pwm, 3) }, - { new PCA9685Output(pwm, 4), new PCA9685Output(pwm, 5), new PCA9685Output(pwm, 6), new PCA9685Output(pwm, 7) }, - // clang-format on - }); - auto backOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new PCA9685Output(pwm, 8), new PCA9685Output(pwm, 9), new PCA9685Output(pwm, 10), new PCA9685Output(pwm, 11) }, - { new PCA9685Output(pwm, 12), new PCA9685Output(pwm, 13), new PCA9685Output(pwm, 14), new PCA9685Output(pwm, 15) }, - // clang-format on - }); - app->getVibroBody()->addTarget(Target::ChestFront, new FloatPlane(frontOutputs)); app->getVibroBody()->addTarget(Target::ChestBack, new FloatPlane(backOutputs)); diff --git a/firmware/variants/bhaptics/tactsuit_x40/tactsuit_x40.cpp b/firmware/variants/bhaptics/tactsuit_x40/tactsuit_x40.cpp index c2958512..f16b3194 100644 --- a/firmware/variants/bhaptics/tactsuit_x40/tactsuit_x40.cpp +++ b/firmware/variants/bhaptics/tactsuit_x40/tactsuit_x40.cpp @@ -34,12 +34,34 @@ Application* app = &App; static const std::array bhLayout = { BH_LAYOUT_TACTSUITX40 }; +auto pwm0 = i2cdev::PCA9685(0x40, I2CDev); +auto pwm1 = i2cdev::PCA9685(0x41, I2CDev); + +// Assign the pins on the configured PCA9685s and PWM pins to locations on the vest +auto frontOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new PCA9685Output(pwm0, 0), new PCA9685Output(pwm0, 1), new PCA9685Output(pwm0, 2), new PCA9685Output(pwm0, 3) }, + { new PCA9685Output(pwm0, 4), new PCA9685Output(pwm0, 5), new PCA9685Output(pwm0, 6), new PCA9685Output(pwm0, 7) }, + { new PCA9685Output(pwm0, 8), new PCA9685Output(pwm0, 9), new PCA9685Output(pwm0, 10), new PCA9685Output(pwm0, 11) }, + { new PCA9685Output(pwm0, 12), new PCA9685Output(pwm0, 13), new PCA9685Output(pwm0, 14), new PCA9685Output(pwm0, 15) }, + { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25), new LedcOutput(26) }, + // clang-format on +}); +auto backOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new PCA9685Output(pwm1, 0), new PCA9685Output(pwm1, 1), new PCA9685Output(pwm1, 2), new PCA9685Output(pwm1, 3) }, + { new PCA9685Output(pwm1, 4), new PCA9685Output(pwm1, 5), new PCA9685Output(pwm1, 6), new PCA9685Output(pwm1, 7) }, + { new PCA9685Output(pwm1, 8), new PCA9685Output(pwm1, 9), new PCA9685Output(pwm1, 10), new PCA9685Output(pwm1, 11) }, + { new PCA9685Output(pwm1, 12), new PCA9685Output(pwm1, 13), new PCA9685Output(pwm1, 14), new PCA9685Output(pwm1, 15) }, + { new LedcOutput(27), new LedcOutput(14), new LedcOutput(12), new LedcOutput(13) }, + // clang-format on +}); + void setup() { Wire.begin(); // Configure the PCA9685s - auto pwm0 = i2cdev::PCA9685(0x40, I2CDev); if (pwm0.setFrequency(PWM_FREQUENCY) != I2CDEV_RESULT_OK) { LOG_E("pca9685", "Failed to set frequency"); } @@ -47,7 +69,6 @@ void setup() LOG_E("pca9685", "Failed to wake up"); } - auto pwm1 = i2cdev::PCA9685(0x41, I2CDev); if (pwm1.setFrequency(PWM_FREQUENCY) != I2CDEV_RESULT_OK) { LOG_E("pca9685", "Failed to set frequency"); } @@ -55,27 +76,6 @@ void setup() LOG_E("pca9685", "Failed to wake up"); } - // Assign the pins on the configured PCA9685s and PWM pins to locations on the - // vest - auto frontOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new PCA9685Output(pwm0, 0), new PCA9685Output(pwm0, 1), new PCA9685Output(pwm0, 2), new PCA9685Output(pwm0, 3) }, - { new PCA9685Output(pwm0, 4), new PCA9685Output(pwm0, 5), new PCA9685Output(pwm0, 6), new PCA9685Output(pwm0, 7) }, - { new PCA9685Output(pwm0, 8), new PCA9685Output(pwm0, 9), new PCA9685Output(pwm0, 10), new PCA9685Output(pwm0, 11) }, - { new PCA9685Output(pwm0, 12), new PCA9685Output(pwm0, 13), new PCA9685Output(pwm0, 14), new PCA9685Output(pwm0, 15) }, - { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25), new LedcOutput(26) }, - // clang-format on - }); - auto backOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new PCA9685Output(pwm1, 0), new PCA9685Output(pwm1, 1), new PCA9685Output(pwm1, 2), new PCA9685Output(pwm1, 3) }, - { new PCA9685Output(pwm1, 4), new PCA9685Output(pwm1, 5), new PCA9685Output(pwm1, 6), new PCA9685Output(pwm1, 7) }, - { new PCA9685Output(pwm1, 8), new PCA9685Output(pwm1, 9), new PCA9685Output(pwm1, 10), new PCA9685Output(pwm1, 11) }, - { new PCA9685Output(pwm1, 12), new PCA9685Output(pwm1, 13), new PCA9685Output(pwm1, 14), new PCA9685Output(pwm1, 15) }, - { new LedcOutput(27), new LedcOutput(14), new LedcOutput(12), new LedcOutput(13) }, - // clang-format on - }); - app->getVibroBody()->addTarget(Target::ChestFront, new FloatPlane(frontOutputs)); app->getVibroBody()->addTarget(Target::ChestBack, new FloatPlane(backOutputs)); diff --git a/firmware/variants/bhaptics/tactvisor/tactvisor.cpp b/firmware/variants/bhaptics/tactvisor/tactvisor.cpp index e5cb6e56..a1a331c5 100644 --- a/firmware/variants/bhaptics/tactvisor/tactvisor.cpp +++ b/firmware/variants/bhaptics/tactvisor/tactvisor.cpp @@ -29,15 +29,15 @@ Application* app = &App; static const std::array bhLayout = { BH_LAYOUT_TACTVISOR }; +// Configure PWM pins to their positions on the face +auto faceOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ + // clang-format off + { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25), new LedcOutput(26) }, + // clang-format on +}); + void setup() { - // Configure PWM pins to their positions on the face - auto faceOutputs = PlaneMapper_Margin::mapMatrixCoordinates({ - // clang-format off - { new LedcOutput(32), new LedcOutput(33), new LedcOutput(25), new LedcOutput(26) }, - // clang-format on - }); - app->getVibroBody()->addTarget(Target::FaceFront, new FloatPlane(faceOutputs)); app->getVibroBody()->setup();