16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

uart now optional, macos openal fix

This commit is contained in:
milek
2019-03-25 19:53:44 +00:00
parent aaf67caae2
commit c09160d8f5
6 changed files with 35 additions and 12 deletions

View File

@@ -9,6 +9,9 @@ set(CMAKE_CXX_STANDARD 14)
include_directories("." "Console" "McZapkie") include_directories("." "Console" "McZapkie")
file(GLOB HEADERS "*.h" "Console/*.h" "McZapkie/*.h") file(GLOB HEADERS "*.h" "Console/*.h" "McZapkie/*.h")
option(USE_IMGUI_GL3 "Use OpenGL3+ imgui implementation" OFF)
option(WITH_UART "Compile with libserialport" OFF)
set(SOURCES set(SOURCES
"Texture.cpp" "Texture.cpp"
"Timer.cpp" "Timer.cpp"
@@ -66,7 +69,6 @@ set(SOURCES
"material.cpp" "material.cpp"
"lua.cpp" "lua.cpp"
"stdafx.cpp" "stdafx.cpp"
"uart.cpp"
"messaging.cpp" "messaging.cpp"
"scene.cpp" "scene.cpp"
"scenenode.cpp" "scenenode.cpp"
@@ -105,8 +107,6 @@ set(SOURCES
"imgui/imgui_impl_glfw.cpp" "imgui/imgui_impl_glfw.cpp"
) )
option(USE_IMGUI_GL3 "Use OpenGL3+ imgui implementation" OFF)
if (USE_IMGUI_GL3) if (USE_IMGUI_GL3)
set(SOURCES ${SOURCES} "imgui/imgui_impl_opengl3.cpp") set(SOURCES ${SOURCES} "imgui/imgui_impl_opengl3.cpp")
else() else()
@@ -114,6 +114,10 @@ else()
set(SOURCES ${SOURCES} "imgui/imgui_impl_opengl2.cpp") set(SOURCES ${SOURCES} "imgui/imgui_impl_opengl2.cpp")
endif() endif()
if (WITH_UART)
set(SOURCES ${SOURCES} "uart.cpp")
endif()
set (PREFIX "") set (PREFIX "")
if (WIN32) if (WIN32)
@@ -202,9 +206,7 @@ include_directories(${PYTHON_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES})
find_package(PNG REQUIRED) find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIRS} ${PNG_PNG_INCLUDE_DIR}) target_link_libraries(${PROJECT_NAME} PNG::PNG)
target_link_libraries(${PROJECT_NAME} ${PNG_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${PNG_LIBRARY})
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} Threads::Threads) target_link_libraries(${PROJECT_NAME} Threads::Threads)
@@ -224,9 +226,11 @@ find_package(LuaJIT REQUIRED)
include_directories(${LUAJIT_INCLUDE_DIR}) include_directories(${LUAJIT_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} ${LUAJIT_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${LUAJIT_LIBRARIES})
if (WITH_UART)
find_package(libserialport REQUIRED) find_package(libserialport REQUIRED)
include_directories(${libserialport_INCLUDE_DIR}) include_directories(${libserialport_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} ${libserialport_LIBRARY}) target_link_libraries(${PROJECT_NAME} ${libserialport_LIBRARY})
endif()
if (WIN32) if (WIN32)
target_link_libraries(${PROJECT_NAME} ws2_32) target_link_libraries(${PROJECT_NAME} ws2_32)

View File

@@ -647,6 +647,7 @@ global_settings::ConfigParse(cParser &Parser) {
Parser.getTokens(1); Parser.getTokens(1);
Parser >> Global.screenshot_dir; Parser >> Global.screenshot_dir;
} }
#ifdef WITH_UART
else if( token == "uart" ) { else if( token == "uart" ) {
uart_conf.enable = true; uart_conf.enable = true;
Parser.getTokens( 3, false ); Parser.getTokens( 3, false );
@@ -685,6 +686,7 @@ global_settings::ConfigParse(cParser &Parser) {
Parser.getTokens( 1 ); Parser.getTokens( 1 );
Parser >> uart_conf.debug; Parser >> uart_conf.debug;
} }
#endif
else if (token == "loadinglog") { else if (token == "loadinglog") {
Parser.getTokens( 1 ); Parser.getTokens( 1 );
Parser >> loading_log; Parser >> loading_log;

View File

@@ -14,10 +14,12 @@ http://mozilla.org/MPL/2.0/.
#include "dumb3d.h" #include "dumb3d.h"
#include "Float3d.h" #include "Float3d.h"
#include "light.h" #include "light.h"
#include "uart.h"
#include "utilities.h" #include "utilities.h"
#include "motiontelemetry.h" #include "motiontelemetry.h"
#include "version.h" #include "version.h"
#ifdef WITH_UART
#include "uart.h"
#endif
struct global_settings { struct global_settings {
// members // members
@@ -168,7 +170,9 @@ struct global_settings {
0, 0, 0, 0, 0, 0, 0 }; 0, 0, 0, 0, 0, 0, 0 };
int iCalibrateOutDebugInfo { -1 }; // numer wyjścia kalibrowanego dla którego wyświetlać informacje podczas kalibracji int iCalibrateOutDebugInfo { -1 }; // numer wyjścia kalibrowanego dla którego wyświetlać informacje podczas kalibracji
int iPoKeysPWM[ 7 ] = { 0, 1, 2, 3, 4, 5, 6 }; // numery wejść dla PWM int iPoKeysPWM[ 7 ] = { 0, 1, 2, 3, 4, 5, 6 }; // numery wejść dla PWM
#ifdef WITH_UART
uart_input::conf_t uart_conf; uart_input::conf_t uart_conf;
#endif
// multiplayer // multiplayer
int iMultiplayer{ 0 }; // blokada działania niektórych eventów na rzecz kominikacji int iMultiplayer{ 0 }; // blokada działania niektórych eventów na rzecz kominikacji
// other // other

View File

@@ -9,8 +9,13 @@ http://mozilla.org/MPL/2.0/.
#pragma once #pragma once
#ifdef __APPLE__
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h> #include <AL/al.h>
#include <AL/alc.h> #include <AL/alc.h>
#endif
namespace audio { namespace audio {

View File

@@ -45,9 +45,11 @@ driver_mode::drivermode_input::poll() {
if( true == Global.InputGamepad ) { if( true == Global.InputGamepad ) {
gamepad.poll(); gamepad.poll();
} }
#ifdef WITH_UART
if( uart != nullptr ) { if( uart != nullptr ) {
uart->poll(); uart->poll();
} }
#endif
/* /*
// TBD, TODO: wrap current command in object, include other input sources? // TBD, TODO: wrap current command in object, include other input sources?
input::command = ( input::command = (
@@ -67,10 +69,12 @@ driver_mode::drivermode_input::init() {
if( true == Global.InputGamepad ) { if( true == Global.InputGamepad ) {
gamepad.init(); gamepad.init();
} }
#ifdef WITH_UART
if( true == Global.uart_conf.enable ) { if( true == Global.uart_conf.enable ) {
uart = std::make_unique<uart_input>(); uart = std::make_unique<uart_input>();
uart->init(); uart->init();
} }
#endif
if (Global.motiontelemetry_conf.enable) if (Global.motiontelemetry_conf.enable)
telemetry = std::make_unique<motiontelemetry>(); telemetry = std::make_unique<motiontelemetry>();

View File

@@ -14,10 +14,12 @@ http://mozilla.org/MPL/2.0/.
#include "driverkeyboardinput.h" #include "driverkeyboardinput.h"
#include "drivermouseinput.h" #include "drivermouseinput.h"
#include "gamepadinput.h" #include "gamepadinput.h"
#include "uart.h"
#include "Console.h" #include "Console.h"
#include "Camera.h" #include "Camera.h"
#include "Classes.h" #include "Classes.h"
#ifdef WITH_UART
#include "uart.h"
#endif
class driver_mode : public application_mode { class driver_mode : public application_mode {
@@ -75,7 +77,9 @@ private:
#ifdef _WIN32 #ifdef _WIN32
Console console; Console console;
#endif #endif
#ifdef WITH_UART
std::unique_ptr<uart_input> uart; std::unique_ptr<uart_input> uart;
#endif
std::unique_ptr<motiontelemetry> telemetry; std::unique_ptr<motiontelemetry> telemetry;
bool init(); bool init();