diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml new file mode 100644 index 0000000..c00a79b --- /dev/null +++ b/.github/workflows/github-actions.yml @@ -0,0 +1,112 @@ +on: [push, pull_request] +jobs: + j1: + name: Ubuntu 18.04 + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - run: cmake . && cmake --build . +# - run: cmake -D CMAKE_BUILD_TYPE=Release . && cmake --build . --parallel + + j2: + name: Windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - run: cmake . & cmake --build . --config Release --target Test_devices --parallel + shell: cmd + + j3: + name: macOS 10.15 + runs-on: macos-10.15 + steps: + - uses: actions/checkout@v2 + - run: cmake . && cmake --build . +# - run: cmake -D CMAKE_BUILD_TYPE=Release . && cmake --build . --parallel + + j4: + name: Windows MinGW 8.1.0 x64 + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 +# - run: choco install -y make + - run: cmake -G "MSYS Makefiles" -D CMAKE_BUILD_TYPE=Release . && cmake --build . --parallel + shell: bash + + j5: + name: Ubuntu 16.04 + runs-on: ubuntu-16.04 + steps: + - uses: actions/checkout@v2 + - run: make && make clean && cmake -D CMAKE_BUILD_TYPE=Release . && cmake --build . + + j6: + name: Ubuntu 18.04 Qt + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - run: | + sudo apt-get -q update || true # Allowed to fail... + #wget http://www.ensta-bretagne.fr/lebars/Share/qt-sdk-linux-x86_64-opensource-2010.05.1.bin + #chmod +x qt-sdk-linux-x86_64-opensource-2010.05.1.bin + # Unattended mode has a bug, see https://bugreports.qt.io/browse/QTCREATORBUG-472...? + #./qt-sdk-linux-x86_64-opensource-2010.05.1.bin --mode unattended + sudo apt-get -y install qtcreator qt5-default + - run: qmake && make + + j7: + name: Windows Qt 2010.05 MinGW 4.4.0 x86 + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 +# - run: choco install -y -r --no-progress wget + - run: | + (New-Object System.Net.WebClient).DownloadFile("http://www.ensta-bretagne.fr/lebars/Share/windows_extra_tools.zip", "C:\Windows\Temp\windows_extra_tools.zip") + 7z x C:\Windows\Temp\windows_extra_tools.zip -o"C:\Windows" -y + shell: pwsh +# - run: | +# rem Take 5 min... +# choco uninstall -y mingw +# shell: cmd + - run: | + wget http://www.ensta-bretagne.fr/lebars/Share/qt-sdk-win-opensource-2010.05.exe --no-check-certificate -nv + move /Y qt-sdk-win-opensource-2010.05.exe %SystemDrive%\ + rem Take several min... + %SystemDrive%\qt-sdk-win-opensource-2010.05.exe /S + del /f /q %SystemDrive%\qt-sdk-win-opensource-2010.05.exe + shell: cmd + - run: | + rem %SystemDrive%\Qt\2010.05\bin\qtenv.bat & qmake -r -spec win32-g++ & mingw32-make -w + %SystemDrive%\Qt\2010.05\bin\qtenv.bat & qmake & mingw32-make + shell: cmd + + j8: + name: Windows Qt 5.12.6 MinGW 7.3.0 x86 + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 +# - run: choco install -y -r --no-progress wget + - run: | + (New-Object System.Net.WebClient).DownloadFile("http://www.ensta-bretagne.fr/lebars/Share/windows_extra_tools.zip", "C:\Windows\Temp\windows_extra_tools.zip") + 7z x C:\Windows\Temp\windows_extra_tools.zip -o"C:\Windows" -y + shell: pwsh +# - run: | +# rem Take 5 min... +# choco uninstall -y mingw +# shell: cmd + - run: | + wget http://download.qt.io/archive/qt/5.12/5.12.6/qt-opensource-windows-x86-5.12.6.exe --no-check-certificate -nv + move /Y qt-opensource-windows-x86-5.12.6.exe %SystemDrive%\ + wget http://www.ensta-bretagne.fr/lebars/Share/qt-installer-5.12.6-mingw73_32.qs --no-check-certificate -nv + move /Y qt-installer-5.12.6-mingw73_32.qs %SystemDrive%\ + netsh advfirewall set allprofiles state on + netsh advfirewall firewall add rule name="Qt offline installer" dir=out action=block program="%SystemDrive%\qt-opensource-windows-x86-5.12.6.exe" enable=yes + rem Take several min... + %SystemDrive%\qt-opensource-windows-x86-5.12.6.exe --script %SystemDrive%\qt-installer-5.12.6-mingw73_32.qs + netsh advfirewall firewall del rule name="Qt offline installer" + netsh advfirewall set allprofiles state off + del /f /q %SystemDrive%\qt-opensource-windows-x86-5.12.6.exe + shell: cmd + - run: | + set PATH=C:\Qt\Qt5.12.6\5.12.6\mingw73_32\bin;C:\Qt\Qt5.12.6\Tools\mingw730_32\bin;%PATH% & qmake & mingw32-make + shell: cmd diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 078a58b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,83 +0,0 @@ -language: cpp -jobs: - include: - - name: "Ubuntu 18.04" - os: linux - dist: bionic - compiler: gcc - script: cmake . && cmake --build . -# script: cmake -D CMAKE_BUILD_TYPE=Release . && cmake --build . --parallel - - - name: "Windows" - os: windows - script: - - cmd //c "cmake . & cmake --build . --config Release --target Test_devices --parallel" - - - name: "Mac OS" - os: osx - osx_image: xcode10.1 - script: cmake . && cmake --build . -# script: cmake -D CMAKE_BUILD_TYPE=Release . && cmake --build . --parallel - - - name: "Windows MinGW 8.1.0 x64" - os: windows - compiler: gcc - before_install: - - choco install -y make - script: - - cmake -G "MSYS Makefiles" -D CMAKE_BUILD_TYPE=Release . && cmake --build . --parallel - - - name: "Ubuntu 12.04" - os: linux - dist: precise - compiler: gcc - script: make && make clean && cmake -D CMAKE_BUILD_TYPE=Release . && cmake --build . - - - name: "Ubuntu 18.04 Qt" - os: linux - dist: bionic - compiler: gcc - before_install: - # Allowed to fail... - - sudo apt-get -q update || true -# - wget http://www.ensta-bretagne.fr/lebars/Share/qt-sdk-linux-x86_64-opensource-2010.05.1.bin -# - chmod +x qt-sdk-linux-x86_64-opensource-2010.05.1.bin -# # Unattended mode has a bug, see https://bugreports.qt.io/browse/QTCREATORBUG-472...? -# - ./qt-sdk-linux-x86_64-opensource-2010.05.1.bin --mode unattended - - sudo apt-get -y install qtcreator qt5-default - script: qmake && make - - - name: "Windows Qt 2010.05 MinGW 4.4.0 x86" - os: windows - compiler: gcc - before_install: - # Take 2 min... - - choco uninstall -y mingw - - wget http://www.ensta-bretagne.fr/lebars/Share/qt-sdk-win-opensource-2010.05.exe --no-check-certificate -nv - - cmd //c "move /Y qt-sdk-win-opensource-2010.05.exe %SystemDrive%\ " - # Take several min... - - cmd //c "%SystemDrive%\qt-sdk-win-opensource-2010.05.exe /S" - - cmd //c "del /f /q %SystemDrive%\qt-sdk-win-opensource-2010.05.exe" - script: -# - cmd //c "%SystemDrive%\Qt\2010.05\bin\qtenv.bat & qmake -r -spec win32-g++ & mingw32-make -w" - - cmd //c "%SystemDrive%\Qt\2010.05\bin\qtenv.bat & qmake & mingw32-make" - - - name: "Windows Qt 5.12.6 MinGW 7.3.0 x86" - os: windows - compiler: gcc - before_install: - # Take 2 min... - - choco uninstall -y mingw - - wget http://download.qt.io/archive/qt/5.12/5.12.6/qt-opensource-windows-x86-5.12.6.exe --no-check-certificate -nv - - cmd //c "move /Y qt-opensource-windows-x86-5.12.6.exe %SystemDrive%\ " - - wget http://www.ensta-bretagne.fr/lebars/Share/qt-installer-5.12.6-mingw73_32.qs --no-check-certificate -nv - - cmd //c "move /Y qt-installer-5.12.6-mingw73_32.qs %SystemDrive%\ " - - cmd //c netsh advfirewall set allprofiles state on - - cmd //c netsh advfirewall firewall add rule name="Qt offline installer" dir=out action=block program="%SystemDrive%\qt-opensource-windows-x86-5.12.6.exe" enable=yes - # Take several min... - - cmd //c "%SystemDrive%\qt-opensource-windows-x86-5.12.6.exe --script %SystemDrive%\qt-installer-5.12.6-mingw73_32.qs" - - cmd //c netsh advfirewall firewall del rule name="Qt offline installer" - - cmd //c netsh advfirewall set allprofiles state off - - cmd //c "del /f /q %SystemDrive%\qt-opensource-windows-x86-5.12.6.exe" - script: - - cmd //c "set PATH=C:\Qt\Qt5.12.6\5.12.6\mingw73_32\bin;C:\Qt\Qt5.12.6\Tools\mingw730_32\bin;%PATH% & qmake & mingw32-make" diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fbc63a..49f8ded 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8...3.12) project(Test_devices) diff --git a/Makefile b/Makefile index 67c2206..2b6070e 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ CFLAGS += -D DISABLE_SSC32THREAD CFLAGS += -D DISABLE_SWARMONDEVICETHREAD CFLAGS += -D DISABLE_UBLOXTHREAD -# Depending on your OS (old Linux or Mac OS)... +# Depending on your OS (old Linux or macOS)... #CFLAGS += -D USE_OLD_CHRONO CXXFLAGS += $(CFLAGS) -fpermissive @@ -52,7 +52,7 @@ CXXFLAGS += $(CFLAGS) -fpermissive # For MinGW #LDFLAGS += -lws2_32 -lm -# For Mac OS +# For macOS #LDFLAGS += -lm # For Linux diff --git a/RPLIDAR.h b/RPLIDAR.h index 1ba00f2..a47f7ea 100644 --- a/RPLIDAR.h +++ b/RPLIDAR.h @@ -1012,6 +1012,38 @@ inline int SetLidarSpinSpeedRequestRPLIDAR(RPLIDAR* pRPLIDAR, int rpm) return EXIT_SUCCESS; } +inline int StartMotorRPLIDAR(RPLIDAR* pRPLIDAR) +{ +#ifdef ENABLE_RPLIDAR_SDK_SUPPORT + if (IS_FAIL(pRPLIDAR->drv->startMotor())) + { + printf("A RPLIDAR is not responding correctly : startMotor() failed. \n"); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +#else + UNREFERENCED_PARAMETER(pRPLIDAR); + printf("RPLIDAR : Not implemented. \n"); + return EXIT_NOT_IMPLEMENTED; +#endif // ENABLE_RPLIDAR_SDK_SUPPORT +} + +inline int StopMotorRPLIDAR(RPLIDAR* pRPLIDAR) +{ +#ifdef ENABLE_RPLIDAR_SDK_SUPPORT + if (IS_FAIL(pRPLIDAR->drv->stopMotor())) + { + printf("A RPLIDAR is not responding correctly : stopMotor() failed. \n"); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +#else + UNREFERENCED_PARAMETER(pRPLIDAR); + printf("RPLIDAR : Not implemented. \n"); + return EXIT_NOT_IMPLEMENTED; +#endif // ENABLE_RPLIDAR_SDK_SUPPORT +} + inline int StartScanRequestRPLIDAR(RPLIDAR* pRPLIDAR) { #ifdef ENABLE_RPLIDAR_SDK_SUPPORT