open-merou

Open Mérou, a free iOS app for the Oceanic+ underwater iPhone housing
git clone https://git.schurger.org/open-merou.git
Log | Files | Refs | README | LICENSE

commit 0ac4d0d02a40b3f29da2618bf5d81cd2a6e4b5e1
parent e158df29d5fda64af6f249c3ad4a1b5ba4edbcd5
Author: Jean Schurger <jean@schurger.org>
Date:   Sat, 14 Nov 2026 14:29:55 -0500

Home screen shows the housing status directly: no "Start housing mode" step

The housing is searched from launch, as before the dive computer home: the
left side of the home screen says "searching" until a housing answers, then
shows what to check before closing it (batteries, free space, airplane
mode) and the prompt to press its right button, which starts the vacuum
sequence. "Simulate a housing" stays as the secondary button.

The "Start housing mode" button, the intermediate start card and its Back
button are gone, with their strings. "-demoHousingDetected" shows the
detected state for screenshots.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Diffstat:
MOpenMerou/App/AppModel.swift | 3---
MOpenMerou/Localizable.xcstrings | 30------------------------------
MOpenMerou/UI/CameraScreen.swift | 84+------------------------------------------------------------------------------
MOpenMerou/UI/HomeScreen.swift | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
MREADME.md | 6+++---
5 files changed, 62 insertions(+), 131 deletions(-)

diff --git a/OpenMerou/App/AppModel.swift b/OpenMerou/App/AppModel.swift @@ -46,8 +46,6 @@ final class AppModel { /// Depth (m) and dive start: experimental, until 1625 has been validated in the water. var depth: Double? { dive.depth } var diveStart: Date? { dive.diveStart } - /// "Start housing mode" was touched on the home screen: the housing start card replaces the home. - var housingMode = false /// Full-screen dive computer page (long press up, or Menu → Dive computer). private(set) var showingComputer = false /// Dive alarm: the sound stops at the first button press, the red flash stays. @@ -114,7 +112,6 @@ final class AppModel { housing.linkLost = { [weak self] in self?.dive.linkLost() } housing.sessionStarted = { [weak self] in self?.dive.reset() - self?.housingMode = false self?.showingComputer = false } dive.onCue = { [weak self] cue in self?.diveCue(cue) } diff --git a/OpenMerou/Localizable.xcstrings b/OpenMerou/Localizable.xcstrings @@ -581,16 +581,6 @@ } } }, - "Dive computer on: %@ · %@": { - "localizations": { - "fr": { - "stringUnit": { - "state": "translated", - "value": "Ordinateur de plongée activé : %@ · %@" - } - } - } - }, "Dive no. %@ saved": { "localizations": { "fr": { @@ -831,16 +821,6 @@ } } }, - "Housing mode": { - "localizations": { - "fr": { - "stringUnit": { - "state": "translated", - "value": "Mode boîtier" - } - } - } - }, "Housing vented": { "localizations": { "fr": { @@ -1811,16 +1791,6 @@ } } }, - "Start housing mode": { - "localizations": { - "fr": { - "stringUnit": { - "state": "translated", - "value": "Démarrer le mode boîtier" - } - } - } - }, "Stop the pump": { "localizations": { "fr": { diff --git a/OpenMerou/UI/CameraScreen.swift b/OpenMerou/UI/CameraScreen.swift @@ -64,11 +64,7 @@ struct CameraScreen: View { if !model.camera.authorized { card { Text("Allow camera access in Settings → Open Mérou.") } } else if housing.vacuum.step == .prepare, !housing.simulated { - if model.housingMode { - card { HousingStartView(model: model) } - } else { - HomeScreen(model: model) - } + HomeScreen(model: model) } else if !housing.vacuum.cameraHasButtons { card { VacuumView(vacuum: housing.vacuum) @@ -410,84 +406,6 @@ struct InfoPanel: View { } } -/// Housing mode, first step: the housing is searched, detected, then its right button starts the vacuum -/// sequence. Reached from the home screen ("Start housing mode"); "Back" returns there. -struct HousingStartView: View { - let model: AppModel - - /// What is worth fixing before closing the housing. - private var checks: [String] { - var lines: [String] = [] - if let b = model.housing.readings.batteryPercent, b < 30 { lines.append(String(localized: "Housing battery low: \(String(b)) %")) } - if let b = model.phoneBattery, b < 30 { lines.append(String(localized: "iPhone battery low: \(String(b)) %")) } - if let minutes = model.videoMinutesLeft, minutes < 20 { - lines.append(String(localized: "Low free space: about \(String(minutes)) min of video in \(model.settings.videoQuality.label)")) - } - if model.online { lines.append(String(localized: "Airplane mode recommended (keep Bluetooth on)")) } - return lines - } - - var body: some View { - let housing = model.housing - VStack(alignment: .leading, spacing: 12) { - HStack { - Text("Housing mode").font(.title2.bold()) - Spacer() - Button { model.housingMode = false } label: { Label("Back", systemImage: "chevron.left") } - .buttonStyle(.bordered) - } - - if housing.isConnected { - VStack(alignment: .leading, spacing: 6) { - Label("Housing detected", systemImage: "checkmark.circle.fill").font(.headline).foregroundStyle(.green) - if model.dive.isActive { - let s = model.dive.store.settings - Label("Dive computer on: \(s.gas.description) · \(SettingsText.conservatism(s))", systemImage: "gauge.with.dots.needle.bottom.50percent") - .font(.footnote).foregroundStyle(.cyan) - } - if let p = housing.vacuum.pressurePa, p < VacuumSequence.alreadyUnderVacuumPa { - Text("It is already under vacuum: the leak test will start right away.") - } else { - Text("Put the iPhone in place (airplane mode recommended, Bluetooth on), close the housing and lock the latch.") - } - ForEach(checks, id: \.self) { line in - Label(line, systemImage: "exclamationmark.triangle.fill").font(.footnote).foregroundStyle(.orange) - } - Text("Press the right button of the housing to continue").font(.headline) - } - } else { - // Not a real button: it "confirms" by itself when the housing answers. - Button {} label: { - HStack { - Image(systemName: "dot.radiowaves.left.and.right") - if case .bluetoothUnavailable(let why) = housing.status { - Text("Use a housing · Bluetooth \(why)") - } else { - TimelineView(.periodic(from: .now, by: 0.5)) { context in - let dots = Int(context.date.timeIntervalSinceReferenceDate * 2) % 3 + 1 - // Always three dots (fixed width, same font); only the first ones are visible. - HStack(spacing: 0) { - Text("Use a housing · searching") - ForEach(0..<3, id: \.self) { i in Text(".").opacity(i < dots ? 1 : 0) } - } - } - } - } - .frame(maxWidth: .infinity) - } - .buttonStyle(.bordered) - .disabled(true) - Text("Turn the housing on: it will be detected automatically.").font(.footnote).foregroundStyle(.secondary) - } - - ForEach(model.camera.denied, id: \.self) { item in - Label("Permission denied: \(item). Settings → Open Mérou.", systemImage: "exclamationmark.triangle.fill") - .font(.footnote).foregroundStyle(.orange) - } - } - } -} - /// Gallery of the session, driven by the housing buttons (the originals are already in Photos). struct GalleryView: View { let model: AppModel diff --git a/OpenMerou/UI/HomeScreen.swift b/OpenMerou/UI/HomeScreen.swift @@ -4,9 +4,9 @@ import RemoraUI import SwiftUI /// Home screen, the only one made for touch: everything is set here before the housing is closed. -/// One side starts the housing mode (search, vacuum sequence, camera) or its simulation; the other is the home -/// of the optional dive computer, as on the watch: gas and conservatism, settings, last dive and waiting -/// time before flying, dives pending for Sub Rascasse. +/// One side is the housing: searched from launch, then its right button starts the vacuum sequence (or a +/// simulated housing instead). The other is the home of the optional dive computer, as on the watch: gas +/// and conservatism, settings, last dive and waiting time before flying, dives pending for Sub Rascasse. struct HomeScreen: View { let model: AppModel @Environment(\.openURL) private var openURL @@ -44,18 +44,67 @@ struct HomeScreen: View { // MARK: Housing + /// What is worth fixing before closing the housing. + private var checks: [String] { + var lines: [String] = [] + if let b = model.housing.readings.batteryPercent, b < 30 { lines.append(String(localized: "Housing battery low: \(String(b)) %")) } + if let b = model.phoneBattery, b < 30 { lines.append(String(localized: "iPhone battery low: \(String(b)) %")) } + if let minutes = model.videoMinutesLeft, minutes < 20 { + lines.append(String(localized: "Low free space: about \(String(minutes)) min of video in \(model.settings.videoQuality.label)")) + } + if model.online { lines.append(String(localized: "Airplane mode recommended (keep Bluetooth on)")) } + return lines + } + + /// A real housing answers ("-demoHousingDetected": shown as such for screenshots, nothing else changes). + private var housingDetected: Bool { + model.housing.isConnected || CommandLine.arguments.contains("-demoHousingDetected") + } + + /// The housing is searched from launch, nothing to touch: "searching" until it answers, then what to do + /// before closing it and the prompt to press its right button, which starts the vacuum sequence. private var housingColumn: some View { let housing = model.housing return VStack(alignment: .leading, spacing: 12) { Text("Open Mérou").font(.title2.bold()) - Button { model.housingMode = true } label: { - Label("Start housing mode", systemImage: "camera.aperture") - .font(.title3.bold()).frame(maxWidth: .infinity).padding(.vertical, 10) + if housingDetected { + VStack(alignment: .leading, spacing: 6) { + Label("Housing detected", systemImage: "checkmark.circle.fill").font(.headline).foregroundStyle(.green) + if let p = housing.vacuum.pressurePa, p < VacuumSequence.alreadyUnderVacuumPa { + Text("It is already under vacuum: the leak test will start right away.") + } else { + Text("Put the iPhone in place (airplane mode recommended, Bluetooth on), close the housing and lock the latch.") + } + ForEach(checks, id: \.self) { line in + Label(line, systemImage: "exclamationmark.triangle.fill").font(.footnote).foregroundStyle(.orange) + } + Text("Press the right button of the housing to continue").font(.headline) + } + } else { + // Not a real button: it "confirms" by itself when the housing answers. + Button {} label: { + HStack { + Image(systemName: "dot.radiowaves.left.and.right") + if case .bluetoothUnavailable(let why) = housing.status { + Text("Use a housing · Bluetooth \(why)") + } else { + TimelineView(.periodic(from: .now, by: 0.5)) { context in + let dots = Int(context.date.timeIntervalSinceReferenceDate * 2) % 3 + 1 + // Always three dots (fixed width, same font); only the first ones are visible. + HStack(spacing: 0) { + Text("Use a housing · searching") + ForEach(0..<3, id: \.self) { i in Text(".").opacity(i < dots ? 1 : 0) } + } + } + } + } + .frame(maxWidth: .infinity) + } + .buttonStyle(.bordered) + .disabled(true) + Text("Turn the housing on: it will be detected automatically.").font(.footnote).foregroundStyle(.secondary) } - .buttonStyle(.borderedProminent) - .tint(.yellow) - .foregroundStyle(.black) Button { housing.startSimulation() } label: { Label("Simulate a housing", systemImage: "play.rectangle.fill").frame(maxWidth: .infinity) @@ -63,9 +112,6 @@ struct HomeScreen: View { .buttonStyle(.bordered) .disabled(housing.isConnected) - if housing.isConnected { - Label("Housing detected", systemImage: "checkmark.circle.fill").font(.headline).foregroundStyle(.green) - } ForEach(model.camera.denied, id: \.self) { item in Label("Permission denied: \(item). Settings → Open Mérou.", systemImage: "exclamationmark.triangle.fill") .font(.footnote).foregroundStyle(.orange) diff --git a/README.md b/README.md @@ -29,8 +29,8 @@ primary dive computer. The depth comes from the housing's external pressure sens validated underwater yet. - Home screen (touch, before the housing is closed): gas and conservatism, settings, last dive and waiting - time before flying, dives pending for Sub Rascasse; "Start housing mode" starts the search, the vacuum - sequence and the camera. + time before flying, dives pending for Sub Rascasse. The housing is searched from launch; once it is + detected, its right button starts the vacuum sequence, then the camera. - Underwater (housing buttons only): a band over the camera shows depth, dive time, ascent rate and the NDL or the stop to do. A long press up, or Menu → Dive computer, opens a full-screen page (left goes back). The settings can be read in Menu → Information, not changed. @@ -62,7 +62,7 @@ English is the source language of the interface; the French translation lives in Launch options: `-simulation` (simulated housing from the start), `-demoMenu` (opens the settings menu). For the dive computer: `-diveComputer YES -acceptTerms` (on for this launch), `-simulateDive reef|deep|shallow` (simulated housing playing a dive on its pressure sensor; `-diveSkip <seconds>` jumps into it), `-computerPage`, -`-testAlarm`, `-demoLogbook` (a past dive on the home screen), `-showDiveSettings`, `-showTerms`, +`-testAlarm`, `-demoLogbook` (a past dive on the home screen), `-demoHousingDetected` (home screen as with a housing), `-showDiveSettings`, `-showTerms`, `-noPermissionPrompts` (screenshots in the simulator). In the simulated housing, "Simulate a dive" does the same by touch.