Hi, I am a new user and trying to upload the code that i got from open source project (Openchair - hackaday.io) to STM32F446RE board, But I see an error with Build and PIO test. i’m confused what is this error that makes the platform is not working? the error message is below.
[test::*] Building… (1/3)
Please wait…
C:\Users\i3 ivy.platformio\packages\framework-mbed\platform \mbed_critical.c: In function ‘core_util_critical_section_exit’:
C:\Users\i3 ivy.platformio\packages\framework-mbed\platform\mbed_critical.c:86:14: warning: unused variable ‘interrupts_disabled’ [-Wunused-variable]
bool interrupts_disabled = !core_util_are_interrupts_enabled(); /* get the current interrupt disabled state */
^~~~~~~~~~~~~~~~~~~
C:\Users\i3 ivy.platformio\packages\framework-mbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_pcd.c: In function ‘PCD_WriteEmptyTxFifo’:
C:\Users\i3 ivy.platformio\packages\framework-mbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_pcd.c:1285:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (len > ep->maxpacket)
^
C:\Users\i3 ivy.platformio\packages\framework-mbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_pcd.c:1300:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (len > ep->maxpacket)
^
C:\Users\i3 ivy.platformio\packages\framework-mbed\targets\TARGET_STM\TARGET_STM32F4\device\stm32f4xx_hal_pcd.c:1312:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(len <= 0U)
^~
lib\OpenChair\OpenChair.cpp: In member function ‘void OpenChair::drive(double, double, int)’:
lib\OpenChair\OpenChair.cpp:35:19: warning: ‘motBS’ may be used uninitialized in this function [-Wmaybe-uninitialized]
motB=constrain(motBTS+motBS, -1, 1);
lib\OpenChair\OpenChair.cpp:34:19: warning: ‘motAS’ may be used uninitialized in this function [-Wmaybe-uninitialized]
motA=constrain(motATS+motAS, -1, 1);
.pioenvs/nucleo_f446re/test/output_export.o:(.bss.pc+0x0): multiple definition of `pc’
.pioenvs/nucleo_f446re/src/main.o:(.bss.pc+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\nucleo_f446re\firmware.elf] Error 1
[ERROR] Took 26.95 secondsLinter
Severity Provider Description Line
PIO Test
0 files
Code in openchair.cpp
#include “OpenChair.h”
OpenChair::OpenChair(PinName pinMot1Tx, PinName pinMot1Rx, PinName pinMot2Tx, PinName pinMot2Rx, int ms, int Ms):
motor1(pinMot1Tx,pinMot1Rx),motor2(pinMot2Tx,pinMot2Rx), pc(SERIAL_TX, SERIAL_RX){
maxSpeed=Ms;
minSpeed=ms;
if(maxSpeed>512) maxSpeed=512;
motor1.baud(26300);
motor2.baud(26300);
// pc.baud(115200);
}
void OpenChair::drive(double steering, double throttle,int mode){
double motA, motAS, motATS, motB, motBS, motBTS;
if(mode==1 && throttle<0){ motATS=constrain(throttle*(1-steering), -1, 1); motBTS=constrain(throttle*(1+steering), -1, 1); }else{ motATS=constrain(throttle*(1+steering), -1, 1); motBTS=constrain(throttle*(1-steering), -1, 1); }
if(mode==1){ motAS=+steering*(1-fabs(throttle)); motBS=-steering*(1-fabs(throttle)); } else if(mode==0){ motAS=0; motBS=0; }
motA=constrain(motATS + motAS, -1, 1); motB=constrain(motBTS + motBS, -1, 1);
writeMotor1(-motA); writeMotor2(motB);
pc.printf("Motor A, B: %.02f %.02f\n",motA,motB);
}
Please anyone be able to help simple instructions as to how?
I am using PlatformIO atom-ide and windows 7 x64 installation
OpenChair | Hackaday.io openchair is open project to modify manual wheelchair into an electric using a hoverboard motor, I see some videos from this project work well.
Many thanks for your reply and help.