Skip to content

Commit fb34adb

Browse files
authored
Merge pull request #1 from CardputerZero/release/0.1.1
Prepare 0.1.1 package launch
2 parents 2698c3e + 900e4b7 commit fb34adb

5 files changed

Lines changed: 24 additions & 15 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.16)
22

3-
project(M5CardputerZeroCompass VERSION 0.1.0 LANGUAGES C CXX ASM)
3+
project(M5CardputerZeroCompass VERSION 0.1.1 LANGUAGES C CXX ASM)
44

55
option(COMPASS_USE_SDL "Use LVGL's SDL backend for desktop testing" ON)
66
option(COMPASS_CONVERT_ASSETS "Convert image assets during CMake configure" ON)

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ Run the SDL build:
9797
```
9898

9999
Calibration data is saved to `calibration.conf` for SDL builds. Packaged
100-
CardputerZero launches set `COMPASS_CONFIG_DIR="$HOME/.config/Compass"`, so
101-
calibration data is saved to `$HOME/.config/Compass/calibration.conf`.
100+
CardputerZero launches use `$HOME/.config/Compass/calibration.conf` by default.
102101

103102
Override the calibration path:
104103

@@ -126,5 +125,5 @@ build and produces an `arm64` APPLaunch package.
126125
The generated package is written to `dist/`:
127126

128127
```text
129-
dist/m5cardputerzero-compass_0.1.0_m5stack1_arm64.deb
128+
dist/m5cardputerzero-compass_0.1.1_m5stack1_arm64.deb
130129
```

packaging/deb/compass.desktop.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Desktop Entry]
22
Name=Compass
3-
Exec=@DESKTOP_EXEC@
3+
Exec=/usr/share/APPLaunch/bin/M5CardputerZero-Compass
44
Terminal=false
55
Icon=share/images/@PACKAGE_ICON_NAME@
66
Type=Application

packaging/deb/package_deb.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ STAGE_DIR="${STAGE_DIR:-${ROOT_DIR}/build/deb-root}"
1313
DIST_DIR="${DIST_DIR:-${ROOT_DIR}/dist}"
1414
BIN_NAME="M5CardputerZero-Compass"
1515
PACKAGE_ICON_NAME="${PACKAGE_ICON_NAME:-m5cardputerzero-compass.png}"
16-
CONFIG_DIR="${CONFIG_DIR:-\$HOME/.config/Compass}"
1716
CMAKE_BIN="${CMAKE:-cmake}"
1817
CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}"
1918

@@ -90,9 +89,7 @@ mkdir -p \
9089
"${DIST_DIR}"
9190

9291
install -m 755 "${EXECUTABLE}" "${STAGE_DIR}/usr/share/APPLaunch/bin/${BIN_NAME}"
93-
DESKTOP_EXEC="mkdir -p \"${CONFIG_DIR}\" && COMPASS_CONFIG_DIR=\"${CONFIG_DIR}\" exec /usr/share/APPLaunch/bin/${BIN_NAME}"
9492
sed \
95-
-e "s|@DESKTOP_EXEC@|${DESKTOP_EXEC}|g" \
9693
-e "s|@PACKAGE_ICON_NAME@|${PACKAGE_ICON_NAME}|g" \
9794
"${DESKTOP_TEMPLATE}" >"${STAGE_DIR}/usr/share/APPLaunch/applications/compass.desktop"
9895
install -m 644 "${ICON_FILE}" "${STAGE_DIR}/usr/share/APPLaunch/share/images/${PACKAGE_ICON_NAME}"

src/models/calibration_model.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ namespace compass {
1010

1111
namespace {
1212

13-
constexpr uint32_t kAutoFinishMs = 20000;
13+
constexpr uint32_t kAutoFinishMs = 20000;
1414
constexpr uint32_t kMinimumCalibrationSamples = 20;
15-
constexpr float kMinimumAxisSpan = 0.01f;
16-
constexpr float kCoverageTarget = 80.0f;
17-
constexpr const char* kCalibrationPathEnv = "COMPASS_CALIBRATION_PATH";
18-
constexpr const char* kConfigDirEnv = "COMPASS_CONFIG_DIR";
19-
constexpr const char* kCalibrationFileName = "calibration.conf";
15+
constexpr float kMinimumAxisSpan = 0.01f;
16+
constexpr float kCoverageTarget = 80.0f;
17+
constexpr const char* kCalibrationPathEnv = "COMPASS_CALIBRATION_PATH";
18+
constexpr const char* kConfigDirEnv = "COMPASS_CONFIG_DIR";
19+
constexpr const char* kCalibrationFileName = "calibration.conf";
2020

2121
float axisValue(const Axis3& value, size_t index)
2222
{
@@ -68,6 +68,19 @@ bool envValue(const char* key, std::filesystem::path& path)
6868
return true;
6969
}
7070

71+
std::filesystem::path defaultConfigDir()
72+
{
73+
#if COMPASS_USE_MOCK_IMU
74+
return ".";
75+
#else
76+
const char* home = std::getenv("HOME");
77+
if (home && home[0] != '\0') {
78+
return std::filesystem::path(home) / ".config" / "Compass";
79+
}
80+
return "/tmp/Compass";
81+
#endif
82+
}
83+
7184
float configFloat(const std::unordered_map<std::string, std::string>& values, const char* key, float fallback)
7285
{
7386
const auto it = values.find(key);
@@ -182,7 +195,7 @@ std::filesystem::path CalibrationModel::configPath()
182195
#if COMPASS_USE_MOCK_IMU
183196
return kCalibrationFileName;
184197
#else
185-
return std::filesystem::path("/var/lib/Compass") / kCalibrationFileName;
198+
return defaultConfigDir() / kCalibrationFileName;
186199
#endif
187200
}
188201

0 commit comments

Comments
 (0)