Skip to content

Commit

Permalink
Merge pull request #29 from MuonPi/v2.0.1
Browse files Browse the repository at this point in the history
V2.0.1
  • Loading branch information
dtreffenstaedt authored Jan 29, 2021
2 parents eaddba3 + 343bc50 commit b334296
Show file tree
Hide file tree
Showing 33 changed files with 313 additions and 250 deletions.
36 changes: 19 additions & 17 deletions source/daemon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)

set(Qt5_DIR "/usr/lib/x86_64-linux-gnu/cmake/Qt5/")

find_package(Qt5 COMPONENTS Network SerialPort REQUIRED)

if(NOT WIN32) # added to make program editable in qt-creator on windows

find_library(PAHO_MQTT3C paho-mqtt3c REQUIRED)
find_library(PAHO_MQTT3A paho-mqtt3a REQUIRED)
find_library(PAHO_MQTT3CS paho-mqtt3cs REQUIRED)
Expand All @@ -44,6 +43,9 @@ find_library(CRYPTOPP crypto++ REQUIRED)
find_library(CONFIGPP config++ REQUIRED)
find_library(PIGPIOD_IF2 pigpiod_if2 REQUIRED)
find_library(RT rt REQUIRED)

endif()

find_library(MUONDETECTOR_LIB NAMES muondetector HINTS "${CMAKE_CURRENT_BINARY_DIR}/../lib/" REQUIRED)

add_compile_options(
Expand Down Expand Up @@ -131,9 +133,12 @@ set(LOGIN_SOURCE_FILES
)

set(LOGIN_INSTALL_FILES
"${PROJECT_CONFIG_DIR}/muondetector-login-helper"
"${PROJECT_CONFIG_DIR}/muondetector-login"
)

set(DAEMON_INSTALL_FILES
"${PROJECT_CONFIG_DIR}/muondetector.conf"
)

configure_file(
"${PROJECT_CONFIG_DIR}/muondetector-daemon.1"
Expand All @@ -143,10 +148,6 @@ configure_file(
"${PROJECT_CONFIG_DIR}/muondetector-login.1"
"${CMAKE_CURRENT_BINARY_DIR}/muondetector-login.1"
)
configure_file(
"${PROJECT_CONFIG_DIR}/muondetector-login-helper.1"
"${CMAKE_CURRENT_BINARY_DIR}/muondetector-login-helper.1"
)


add_executable(muondetector-login ${LOGIN_SOURCE_FILES})
Expand Down Expand Up @@ -188,12 +189,13 @@ target_link_libraries(muondetector-daemon
)


set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
if (CMAKE_BUILD_TYPE STREQUAL Release)
add_custom_command(TARGET muondetector-daemon POST_BUILD
COMMAND ${CMAKE_STRIP} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/muondetector-daemon")
add_custom_command(TARGET muondetector-login POST_BUILD
COMMAND ${CMAKE_STRIP} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/muondetector-login")
endif ()

set(DAEMON_INSTALL_FILES
"${PROJECT_CONFIG_DIR}/muondetector.conf"
)



Expand All @@ -202,13 +204,12 @@ include(GNUInstallDirs)
add_custom_target(changelog ALL COMMAND gzip -cn9 "${PROJECT_CONFIG_DIR}/changelog" > "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz")
add_custom_target(manpage ALL COMMAND gzip -cn9 "${CMAKE_CURRENT_BINARY_DIR}/muondetector-daemon.1" > "${CMAKE_CURRENT_BINARY_DIR}/muondetector-daemon.1.gz")
add_custom_target(manpage-login ALL COMMAND gzip -cn9 "${CMAKE_CURRENT_BINARY_DIR}/muondetector-login.1" > "${CMAKE_CURRENT_BINARY_DIR}/muondetector-login.1.gz")
add_custom_target(manpage-login-helper ALL COMMAND gzip -cn9 "${CMAKE_CURRENT_BINARY_DIR}/muondetector-login-helper.1" > "${CMAKE_CURRENT_BINARY_DIR}/muondetector-login-helper.1.gz")

install(TARGETS muondetector-daemon muondetector-login DESTINATION bin COMPONENT daemon)
install(TARGETS muondetector-daemon DESTINATION bin COMPONENT daemon)
install(TARGETS muondetector-login DESTINATION lib/muondetector/bin COMPONENT daemon)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz" DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT daemon)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/muondetector-daemon.1.gz" DESTINATION "share/man/man1/" COMPONENT daemon)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/muondetector-login.1.gz" DESTINATION "share/man/man1/" COMPONENT daemon)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/muondetector-login-helper.1.gz" DESTINATION "share/man/man1/" COMPONENT daemon)
install(FILES "${PROJECT_CONFIG_DIR}/copyright" DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT daemon)
install(FILES ${DAEMON_INSTALL_FILES} DESTINATION "/etc/muondetector/" COMPONENT daemon)
install(FILES "${PROJECT_CONFIG_DIR}/muondetector-daemon.service" DESTINATION "/lib/systemd/system" COMPONENT daemon)
Expand All @@ -218,6 +219,8 @@ install(PROGRAMS ${LOGIN_INSTALL_FILES} DESTINATION bin COMPONENT daemon)


set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "pigpiod, libpaho-mqttpp")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_CONFIG_DIR}/license")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_CONFIG_DIR}/preinst;${PROJECT_CONFIG_DIR}/postinst;${PROJECT_CONFIG_DIR}/prerm;${PROJECT_CONFIG_DIR}/conffiles")
set(CPACK_PACKAGE_VENDOR "MuonPi.org")
Expand All @@ -232,7 +235,6 @@ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION " It opens serial and i2c connections to th
It runs in the background and sends the data to the central server.
It is licensed under the GNU Lesser General Public License version 3 (LGPL v3).")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "MuonPi <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>=2.28), libc++ (>=7), lftp (>=4.7), libcrypto++6, libqt5serialport5 (>= 5), libpaho-mqttpp (>=1.1.0), libconfig++-dev, pigpiod")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../packages/")

include(CPack)
2 changes: 1 addition & 1 deletion source/daemon/config/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ muondetector-daemon (2.0.1) ; urgency=low
* Updates:
- added configuration option for input polarity (input1_polarity/input2_polarity) in muondetector.conf file

-- MuonPi <[email protected]> Wed, 16. Dec 2020 21:55:00 +0100
-- MuonPi <[email protected]> Fri, 29. Jan 2021 10:10:00 +0100

muondetector-daemon (2.0.0) ; urgency=low

Expand Down
2 changes: 1 addition & 1 deletion source/daemon/config/license
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
#Source: https://github.com/marvin5300/muondetector

Files: *
Copyright: 2020 Marvin Peter <[email protected]>
Copyright: 2020 MuonPi.org <[email protected]>
License: GPL-3.0+

License: GPL-3.0+
Expand Down
4 changes: 2 additions & 2 deletions source/daemon/config/muondetector-daemon.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" manpage for muondetector-daemon
.\" Contact [email protected] to correct errors or typos
.\" Contact [email protected] to correct errors or typos
.TH "muondetector-daemon" "1" "@PROJECT_DATE_STRING@" "v @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@" "muondetector manpage"
.SH "NAME"
muondetector-daemon - daemon for muondetector board
Expand Down Expand Up @@ -111,7 +111,7 @@ Default
.SH "BUGS"
No known bugs.
.SH "AUTHOR"
Marvin Peter <[email protected]>
MuonPi.org <[email protected]>
.SH "COPYRIGHT"
License: GPL-3.0+
.PP
Expand Down
2 changes: 2 additions & 0 deletions source/daemon/config/muondetector-login
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
sudo runuser -u muonuser -- /usr/lib/muondetector/bin/muondetector-login
2 changes: 0 additions & 2 deletions source/daemon/config/muondetector-login-helper

This file was deleted.

17 changes: 0 additions & 17 deletions source/daemon/config/muondetector-login-helper.1

This file was deleted.

8 changes: 4 additions & 4 deletions source/daemon/config/muondetector-login.1
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.\" Manpage for muondetector-login
.\" Contact [email protected] to correct errors or typos.
.TH "muondetector-login" "1" "@PROJECT_DATE_STRING@" "v @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@" "muondetector manpage"
.TH "muondetector-login" "1" "@PROJECT_DATE_STRING@" "v @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@" "muondetector login manpage"
.SH NAME
muondetector-login \- Store login information for the muondetector daemon safely
muondetector-login \- Wrapper to execute the muondetector-login as the correct user.
.SH SYNOPSIS
muondetector-login
.SH DESCRIPTION
The muondetector-login program asks for the login information for the muondetector-daemon and stores it safely instead of writing it to the configuration file in plain text. This program should be ran as the user 'muonuser'. There is a helper script available which sets the correct user.
The muondetector-login script starts the program muondetector-login as the correct user to ensure proper execution.
.SH OPTIONS
The muondetector-login program does not take any options. All necessary information is asked for interactively.
.SH SEE ALSO
muondetector-login-helper(1), muondetector-daemon(1)
muondetector-login(1), muondetector-daemon(1)
.SH BUGS
No known bugs.
.SH AUTHOR
Expand Down
2 changes: 1 addition & 1 deletion source/daemon/config/preinst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

mkdir -p /var/muondetector
useradd muonuser -g users -G dialout,pi,i2c,users -s /usr/sbin/nologin -r -N -M -b /var/muondetector
useradd muonuser -g users -G dialout,pi,i2c,users -s /usr/sbin/nologin -r -N -M -b /var/muondetector || echo "User already exists"
chown muonuser:users /var/muondetector
chmod g+w /var/muondetector
7 changes: 2 additions & 5 deletions source/daemon/include/calibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,17 @@ struct CalibStruct;
// meaning of entries (columns is:
// <item name> <item type> <default value>
static const std::vector<std::tuple<std::string, std::string, std::string>> CALIBITEMS = {
std::make_tuple("VERSION", "UINT8", "2") ,
std::make_tuple("VERSION", "UINT8", "3") ,
std::make_tuple("FEATURE_FLAGS", "UINT8", "0") ,
std::make_tuple("CALIB_FLAGS", "UINT8", "0") ,
std::make_tuple("DATE", "UINT32", "0") ,
std::make_tuple("RSENSE", "UINT16", "100") ,
std::make_tuple("VDIV", "UINT16", "1100") ,
std::make_tuple("COEFF0", "FLOAT", "0.0") ,
std::make_tuple("COEFF1", "FLOAT", "1.0") ,
std::make_tuple("COEFF2", "FLOAT", "1.0") ,
std::make_tuple("COEFF2", "FLOAT", "0.0") ,
std::make_tuple("COEFF3", "FLOAT", "1.0") ,
std::make_tuple("WRITE_CYCLES", "UINT32", "1")
/* list init formally introduced in C++17
* but it works with the current gnu c++ compiler with gnu++11 extensions.
* if your compiler is more strict, you should use init via make_tuple*/
};


Expand Down
34 changes: 1 addition & 33 deletions source/daemon/include/gpio_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,8 @@

// define pins on the raspberry pi, UBIAS_EN is the power on/off pin for bias voltage
// PREAMP_1/2 enables the DC voltage to power the preamp through the signal cable
// Attention: the GPIO pin definitions are referring to wiringPi standard except the EVT input pins
// which are in pigpio standard

// HW Ver. 1
/*
//#define UBIAS_EN 4 // pigpio
#define UBIAS_EN 7 // wiringpi
#define PREAMP_1 28 // pigpio 20
#define PREAMP_2 29 // pigpio 21
#define EVT_AND 5
#define EVT_XOR 6
#define GAIN_HL 0 // pigpio 17
#define ADC_READY 23
#define TIMEPULSE 18
#define STATUS1 13 // (23)
#define STATUS2 19 // (24)
#define STATUS3 26 // (25)
*/
// HW Ver 2: pigpio pin numbers (wiring pi numbers)
//#define UBIAS_EN 26 // (25)
//#define PREAMP_1 4 // (7)
//#define PREAMP_2 17 // (0)
//#define EVT_AND 22 // (3)
//#define EVT_XOR 27 // (2)
//#define GAIN_HL 6 // (22)
//#define ADC_READY 12 // (26)
//#define TIMEPULSE 18 // (1)
//#define TIME_MEAS_OUT 5 // (21)
//#define STATUS1 13 // (23)
//#define STATUS2 19 // (24)
//#define PREAMP_FAULT 23 // (4)

// ATTENTION:
// TO MAKE IT MORE SIMPLE THERE WILL BE ONLY PIGPIO,
// TO MAKE IT MORE SIMPLE THERE WILL BE ONLY PIGPIO NAMING STANDARD,
// NO WIRING PI FROM NOW

static const std::map<GPIO_PIN, unsigned int> GPIO_PINMAP_VERSIONS[MAX_HW_VER+1] = {
Expand Down
2 changes: 1 addition & 1 deletion source/daemon/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ int main(int argc, char *argv[])
//if (verbose>2)
qWarning() << "No 'ublox_device' setting in configuration file. Will guess...";
QDir directory("/dev","*",QDir::Name, QDir::System);
QStringList serialports = directory.entryList(QStringList({"ttyS0","ttyAMA0"}));
QStringList serialports = directory.entryList(QStringList({"ttyS0","ttyAMA0","serial0"}));
if (!serialports.empty()){
gpsdevname=QString("/dev/"+serialports.last());
//if (verbose>2)
Expand Down
24 changes: 17 additions & 7 deletions source/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ set(QWT_DIR "C:/Qwt-6.1.4")
set(OPENSSL_DIR "C:/Qt/Tools/OpenSSL/Win_x64")
set(MQTT_CPP_DIR "C:/paho-mqtt-cpp-1.1.0-win64")
set(MQTT_C_DIR "C:/eclipse-paho-mqtt-c-win64-1.3.6")
set(CRYPTOPP_DIR "C:/cryptopp")
list(APPEND CMAKE_PREFIX_PATH "C:/Qt/5.15.1/msvc2019_64/lib/cmake/Qt5QuickCompiler")
list(APPEND CMAKE_PREFIX_PATH "C:/Qt/5.15.1/msvc2019_64/lib/cmake/Qt5")

Expand Down Expand Up @@ -80,14 +81,18 @@ endif()

find_package(Qt5 COMPONENTS Network Svg Widgets Gui Quick QuickWidgets Qml REQUIRED)

if(NOT WIN32)

find_library(PAHO_MQTT3C paho-mqtt3c REQUIRED)
find_library(PAHO_MQTT3A paho-mqtt3a REQUIRED)
find_library(PAHO_MQTT3CS paho-mqtt3cs REQUIRED)
find_library(PAHO_MQTT3AS paho-mqtt3as REQUIRED)
find_library(PAHO_MQTTPP3 paho-mqttpp3 REQUIRED)

find_library(CRYPTOPP crypto++ REQUIRED)
find_library(QWT_QT5 qwt-qt5 REQUIRED)

endif()

find_library(MUONDETECTOR_LIB NAMES muondetector HINTS "${CMAKE_CURRENT_BINARY_DIR}/../lib/" REQUIRED)

set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -229,7 +234,10 @@ add_definitions(-DQWT_DLL)

target_include_directories(muondetector-gui PUBLIC
${OPENSSL_DIR}/include/
$<BUILD_INTERFACE:${CRYPTOPP_DIR}/include>
$<INSTALL_INTERFACE:${CRYPTOPP_DIR}/include>
$<BUILD_INTERFACE:${QWT_DIR}/include>
$<INSTALL_INTERFACE:${QWT_DIR}/include>
$<BUILD_INTERFACE:${MQTT_C_DIR}/include>
$<INSTALL_INTERFACE:${MQTT_C_DIR}/include>
$<BUILD_INTERFACE:${MQTT_CPP_DIR}/include/mqtt>
Expand All @@ -246,6 +254,7 @@ target_link_directories(muondetector-gui PUBLIC
"${MQTT_C_DIR}/lib/"
"${QWT_DIR}/lib/"
"${OPENSSL_DIR}/lib/"
"${CRYPTOPP_DIR}/lib/"
)

target_link_libraries(muondetector-gui
Expand Down Expand Up @@ -347,15 +356,16 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/muondetector-gui.1.gz" DESTINATION "s
install(FILES "${PROJECT_CONFIG_DIR}/copyright" DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT gui)

set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libpaho-mqttpp | paho-mqtt-cpp, qml-module-qtpositioning (>=5), qml-module-qtlocation (>=5), qml-module-qtquick2 (>=5), qml-module-qtquick-layouts (>=5), qml-module-qtquick-controls2 (>=5), qml-module-qtquick-controls (>=5), qml-module-qtquick-templates2 (>=5)")
set(CPACK_DEBIAN_PACKAGE_SECTION "net")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/MuonPi/muondetector")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "It connects to muondetector-daemon via TCP. It is based on Qt and C++.
It lets you change the settings for the muondetector hardware and
uses qml for displaying the current position on the map if connected
the muondetector-daemon.
It is licensed under the GNU Lesser General Public License version 3 (LGPL v3).")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION " It connects to muondetector-daemon via TCP. It is based on Qt and C++.
It lets you change the settings for the muondetector hardware and
uses qml for displaying the current position on the map if connected
the muondetector-daemon.
It is licensed under the GNU Lesser General Public License version 3 (LGPL v3).")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "MuonPi <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>=2.28), libc++ (>=7), libqt5gui5 (>=5), libqt5widgets5 (>=5), libqt5core5a (>=5), libqt5quickwidgets5 (>=5.3), libqt5network5 (>=5), qml-module-qtpositioning (>=5), qml-module-qtlocation (>=5), qml-module-qtquick2 (>=5), qml-module-qtquick-layouts (>=5), qml-module-qtquick-controls2 (>=5), qml-module-qtquick-controls (>=5), qml-module-qtquick-templates2 (>=5), libqwt-qt5-6 (>=6.1.2)")

endif()
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_CONFIG_DIR}/license")
Expand Down
Loading

0 comments on commit b334296

Please sign in to comment.