Skip to content

Commit

Permalink
Merge pull request #90 from MuonPi/v2.1.0
Browse files Browse the repository at this point in the history
V2.1.0
  • Loading branch information
SimonGLM committed May 24, 2023
2 parents 2aa8d1b + ea3159c commit 6cecacd
Show file tree
Hide file tree
Showing 127 changed files with 10,457 additions and 6,615 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ myon_detector/upload_script.sh
*.pdf
.DS_Store
.vscode/settings.json
build/
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ execute_process(COMMAND bash "-c" "git rev-parse --short HEAD | tr -d '\n'"



if ((${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l"))
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^(armv7|armv6)")
set(MUONDETECTOR_BUILD_DAEMON ON)
set(MUONDETECTOR_ON_RASPBERRYPI ON)
endif ()
Expand All @@ -29,8 +29,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/bin")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)



add_compile_options(
-Wall
-O3
Expand All @@ -57,9 +55,20 @@ if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")
add_compile_options(
-mthumb
-march=armv7-a
-mfpu=vfp
-mfloat-abi=hard
)
endif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")

if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv6l")
add_compile_options(
-march=armv6z
-mfpu=vfp
-mfloat-abi=hard
-mtune=arm1176jzf-s
)
endif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv6l")


if (NOT (WIN32 OR APPLE))
set(CPACK_GENERATOR "DEB")
Expand All @@ -71,7 +80,7 @@ endif ()
set(CPACK_RESOURCE_FILE_LICENSE "${MUONDETECTOR_CONFIG_DIR}/license")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/packages")
set(CPACK_PACKAGE_VENDOR "MuonPi.org")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-hotfix2")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${PROJECT_VERSION_ADDITIONAL}")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
Expand All @@ -85,6 +94,7 @@ set(CMAKE_AUTORCC ON)

if(WIN32)
set(QWT_DIR "C:/Qwt-6.2.0")
set(MOSQUITTO_DIR "C:/mosquitto/devel/")
set(OPENSSL_DIR "C:/Qt/Tools/OpenSSL/Win_x64")
set(QTROOT "C:/Qt")
set(QTTOOLS "${QTROOT}/Tools")
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ or

It may be when starting for the first time that, if the daemon is not started as a service, the data folder structure cannot be written due to insufficient rights. Starting the daemon with sudo-er rights should be avoided. Here, the folder structure can be created by hand to solve the issue: copy paste the hashed folder name from the error output of the daemon when started without folder structure and create the folder with `sudo mkdir /var/muondetector/[Hashed Name]` with `notUploadedData` and `uploadedData` as sub-folders. Then, change the user rights with `sudo chown -R pi:pi /var/muondetector`. When restarted, the daemon should be able to write the data.

#### Manjaro

The QT libraries are named differently in Manjaro.
For successful installation, changes to the CMake files have to be made: In `gui.cmake` both occurences of `qwt-qt5` have to be changed to `qwt`.
Compillation can then start as usual with `cmake <source_folder>`, `make` and `make install`.


## RUNNING THE SOFTWARE

### Version < 1.1.2
Expand Down
16 changes: 13 additions & 3 deletions cmake/daemon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ set(MUONDETECTOR_I2C_SOURCE_FILES
"${MUONDETECTOR_DAEMON_SRC_DIR}/hardware/i2c/tca9546a.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/hardware/i2c/ubloxi2c.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/hardware/i2c/x9119.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/hardware/i2c/mic184.cpp"

"${MUONDETECTOR_DAEMON_SRC_DIR}/hardware/i2c/i2cdevice.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/hardware/i2c/i2cutil.cpp"

"${MUONDETECTOR_DAEMON_SRC_DIR}/hardware/i2cdevices.cpp"
)

set(MUONDETECTOR_DAEMON_SOURCE_FILES
Expand All @@ -47,12 +51,14 @@ set(MUONDETECTOR_DAEMON_SOURCE_FILES
"${MUONDETECTOR_DAEMON_SRC_DIR}/qtserialublox_processmessages.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/pigpiodhandler.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/daemon.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/utility/custom_io_operators.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/utility/filehandler.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/calibration.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/utility/gpio_mapping.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/logengine.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/utility/geohash.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/utility/kalman_gnss_filter.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/geoposmanager.cpp"
"${MUONDETECTOR_DAEMON_SRC_DIR}/utility/ratebuffer.cpp"

"${MUONDETECTOR_I2C_SOURCE_FILES}"
"${MUONDETECTOR_SPI_SOURCE_FILES}"
Expand All @@ -77,10 +83,12 @@ set(MUONDETECTOR_I2C_HEADER_FILES
"${MUONDETECTOR_DAEMON_HEADER_DIR}/hardware/i2c/tca9546a.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/hardware/i2c/ubloxi2c.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/hardware/i2c/x9119.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/hardware/i2c/mic184.h"

"${MUONDETECTOR_DAEMON_HEADER_DIR}/hardware/i2c/i2cdevice.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/hardware/i2c/addresses.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/hardware/i2c/i2cutil.h"

"${MUONDETECTOR_DAEMON_HEADER_DIR}/hardware/device_types.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/hardware/i2cdevices.h"
)

Expand All @@ -94,14 +102,16 @@ set(MUONDETECTOR_DAEMON_HEADER_FILES
"${MUONDETECTOR_DAEMON_HEADER_DIR}/qtserialublox.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/daemon.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/pigpiodhandler.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/utility/custom_io_operators.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/utility/unixtime_from_gps.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/utility/filehandler.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/calibration.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/logparameter.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/utility/gpio_mapping.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/logengine.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/utility/geohash.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/utility/kalman_gnss_filter.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/geoposmanager.h"
"${MUONDETECTOR_DAEMON_HEADER_DIR}/utility/ratebuffer.h"

"${MUONDETECTOR_I2C_HEADER_FILES}"
"${MUONDETECTOR_SPI_HEADER_FILES}"
Expand Down
23 changes: 17 additions & 6 deletions cmake/gui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set(MUONDETECTOR_GUI_SOURCE_FILES
"${MUONDETECTOR_GUI_SOURCE_DIR}/custom_histogram_widget.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/custom_plot_widget.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/gnssposwidget.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/gpssatsform.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/gnssinfoform.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/histogramdataform.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/i2cform.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/logplotswidget.cpp"
Expand All @@ -24,7 +24,7 @@ set(MUONDETECTOR_GUI_SOURCE_FILES
"${MUONDETECTOR_GUI_SOURCE_DIR}/parametermonitorform.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/plotcustom.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/scanform.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/settings.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/ubloxsettingsform.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/spiform.cpp"
"${MUONDETECTOR_GUI_SOURCE_DIR}/status.cpp"
)
Expand All @@ -35,7 +35,7 @@ set(MUONDETECTOR_GUI_HEADER_FILES
"${MUONDETECTOR_GUI_HEADER_DIR}/custom_histogram_widget.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/custom_plot_widget.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/gnssposwidget.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/gpssatsform.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/gnssinfoform.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/histogramdataform.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/i2cform.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/logplotswidget.h"
Expand All @@ -44,23 +44,23 @@ set(MUONDETECTOR_GUI_HEADER_FILES
"${MUONDETECTOR_GUI_HEADER_DIR}/parametermonitorform.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/plotcustom.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/scanform.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/settings.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/ubloxsettingsform.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/spiform.h"
"${MUONDETECTOR_GUI_HEADER_DIR}/status.h"
)
set(MUONDETECTOR_GUI_UI_FILES
"${MUONDETECTOR_GUI_UI_DIR}/calibform.ui"
"${MUONDETECTOR_GUI_UI_DIR}/calibscandialog.ui"
"${MUONDETECTOR_GUI_UI_DIR}/gnssposwidget.ui"
"${MUONDETECTOR_GUI_UI_DIR}/gpssatsform.ui"
"${MUONDETECTOR_GUI_UI_DIR}/gnssinfoform.ui"
"${MUONDETECTOR_GUI_UI_DIR}/histogramdataform.ui"
"${MUONDETECTOR_GUI_UI_DIR}/i2cform.ui"
"${MUONDETECTOR_GUI_UI_DIR}/logplotswidget.ui"
"${MUONDETECTOR_GUI_UI_DIR}/mainwindow.ui"
"${MUONDETECTOR_GUI_UI_DIR}/map.ui"
"${MUONDETECTOR_GUI_UI_DIR}/parametermonitorform.ui"
"${MUONDETECTOR_GUI_UI_DIR}/scanform.ui"
"${MUONDETECTOR_GUI_UI_DIR}/settings.ui"
"${MUONDETECTOR_GUI_UI_DIR}/ubloxsettingsform.ui"
"${MUONDETECTOR_GUI_UI_DIR}/spiform.ui"
"${MUONDETECTOR_GUI_UI_DIR}/status.ui"
)
Expand Down Expand Up @@ -97,6 +97,13 @@ if(APPLE)
message(STATUS "QWT found: ${QWT}")
endif()
elseif(WIN32)
find_library(MOSQUITTO
NAMES mosquitto
HINTS ${MOSQUITTO_DIR}
REQUIRED)
if(MOSQUITTO)
message(STATUS "Mosquitto found: ${MOSQUITTO}")
endif()
find_library(QWT
NAMES qwt
HINTS ${QWT_DIR}/lib
Expand Down Expand Up @@ -150,7 +157,10 @@ set_target_properties(muondetector-gui PROPERTIES POSITION_INDEPENDENT_CODE 1)
target_include_directories(muondetector-gui PUBLIC
$<BUILD_INTERFACE:${MUONDETECTOR_GUI_HEADER_DIR}>
$<BUILD_INTERFACE:${LIBRARY_INCLUDE_DIR}>
$<BUILD_INTERFACE:${MOSQUITTO_DIR}>
$<BUILD_INTERFACE:/usr/include/qwt>
#for OSX
$<BUILD_INTERFACE:/usr/local/include>
)

if(WIN32)
Expand All @@ -161,6 +171,7 @@ target_link_libraries(muondetector-gui
muondetector-shared
pthread
${QWT}
${MOSQUITTO}
)

elseif(APPLE)
Expand Down
7 changes: 6 additions & 1 deletion cmake/library.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ set(MUONDETECTOR_LIBRARY_SOURCE_FILES
"${MUONDETECTOR_LIBRARY_SRC_DIR}/tcpconnection.cpp"
"${MUONDETECTOR_LIBRARY_SRC_DIR}/tcpmessage.cpp"
"${MUONDETECTOR_LIBRARY_SRC_DIR}/histogram.cpp"
"${MUONDETECTOR_LIBRARY_SRC_DIR}/custom_io_operators.cpp"
"${MUONDETECTOR_LIBRARY_SRC_DIR}/ublox_structs.cpp"
"${MUONDETECTOR_LIBRARY_SRC_DIR}/networkdiscovery.cpp"
)

set(MUONDETECTOR_LIBRARY_HEADER_FILES
Expand All @@ -27,10 +30,11 @@ set(MUONDETECTOR_LIBRARY_HEADER_FILES
"${MUONDETECTOR_LIBRARY_HEADER_DIR}/tcpmessage.h"
"${MUONDETECTOR_LIBRARY_HEADER_DIR}/tcpmessage_keys.h"
"${MUONDETECTOR_LIBRARY_HEADER_DIR}/ublox_messages.h"
"${MUONDETECTOR_LIBRARY_HEADER_DIR}/ubx_msg_key_name_map.h"
"${MUONDETECTOR_LIBRARY_HEADER_DIR}/ublox_structs.h"
"${MUONDETECTOR_LIBRARY_HEADER_DIR}/muondetector_structs.h"
"${MUONDETECTOR_LIBRARY_HEADER_DIR}/config.h"
"${MUONDETECTOR_LIBRARY_HEADER_DIR}/custom_io_operators.h"
"${MUONDETECTOR_LIBRARY_HEADER_DIR}/networkdiscovery.h"
)

if (MUONDETECTOR_BUILD_DAEMON)
Expand Down Expand Up @@ -59,6 +63,7 @@ target_include_directories(muondetector-shared PUBLIC

if(WIN32)
target_include_directories(muondetector-shared PUBLIC
$<BUILD_INTERFACE:${MOSQUITTO_DIR}/include>
$<BUILD_INTERFACE:${QWT_DIR}/include>
${Qt5Network_INCLUDE_DIRS}
)
Expand Down
4 changes: 2 additions & 2 deletions cmake/version.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(PROJECT_VERSION_MAJOR 2)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 2)
set(PROJECT_VERSION_MINOR 1)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION_ADDITIONAL "")
25 changes: 25 additions & 0 deletions daemon/config/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
muondetector-daemon (2.1.0) ; urgency=low

* Bugfixes:
- removed wrong QT connect call which resulted in a warning in log messages after daemon startup
- fixed reconnect to MQTT broker after connection was lost temporarily
- fixed bug in I2C subsystem which lead to a stuck bus after certain read operations and preventing detection of a device in the next logical read access

* Updates:
- restructured data logging system:
- introduced log rotation and possibility to enable/disable data logging
- simplified structure of data storage path under /var/muondetector
- auto delete old data and log files
- added geo position managing system with three modes of operation:
- static: report position that was statically set (by user or as a result of a lock-in operation, see below)
- auto: report position from most recent uBlox position fix
- lock-in: fix a uBlox position only when accuracy is better than a user defined limit (for pos accuracy and pos DOP values) and make this the new static position
- added several position filters applicable to auto and lock-in modes:
- no filter: uBlox position fixes are not filtered (bad accuracy and bad precision))
- kalman: apply a kalman filter which smoothes the series of last fixes efficiently but poorly filters long term transients/drifts (poor accuracy, excellent precision)
- histogram mean (good accuracy, fair precision)
- histogram median (better accuracy, fair precision)
- histogram most probable value (mpv) (best accuracy, fair precision)
- Added NetworkDiscovery feature (experimental)
-- MuonPi <developer@muonpi.org> Wed, 17. May 2023 10:10:00 +0200

muondetector-daemon (2.0.1) ; urgency=low

* Bugfixes:
Expand Down
6 changes: 2 additions & 4 deletions daemon/include/calibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define CALIBRATION_H

// clang-format off
#include "utility/custom_io_operators.h"
#include <muondetector_structs.h>
#include "hardware/i2cdevices.h"
// clang-format on
Expand Down Expand Up @@ -38,12 +37,11 @@ static const std::vector<std::tuple<std::string, std::string, std::string>> CALI
};

class ShowerDetectorCalib {

public:
static const CalibStruct InvalidCalibStruct;

ShowerDetectorCalib() { init(); }
ShowerDetectorCalib(EEPROM24AA02* eep)
ShowerDetectorCalib(std::shared_ptr<EEPROM24AA02> eep)
: fEeprom(eep)
{
init();
Expand Down Expand Up @@ -79,7 +77,7 @@ class ShowerDetectorCalib {
void buildCalibList();

std::vector<CalibStruct> fCalibList;
EEPROM24AA02* fEeprom = nullptr;
std::shared_ptr<EEPROM24AA02> fEeprom {};
uint8_t fEepBuffer[256];
bool fEepromValid = false;
bool fValid = false;
Expand Down
Loading

0 comments on commit 6cecacd

Please sign in to comment.