Commit Graph

323 Commits

Author SHA1 Message Date
dwjang 444aa6280f fix: critical bug in PiezoPacketCollector processEndPacket
CRITICAL: In multi-channel mode, "ree:" packets between channels
were silently dropped instead of saving the current channel data.
This caused channel data loss when channels are separated by "ree:".

Fixed: Added missing isMultiChannel + ree: branch that calls
saveCurrentChannel() — matching Swift behavior exactly.

Found via line-by-line Swift vs Kotlin verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-21 16:21:43 +09:00
dwjang c1c6dfc16a feat: port algorithm core from iOS (4 files)
GreenZoneConstants.kt — all 16 constants (thresholds, physical)
UrinAI.kt — urine gatekeeper (binary threshold detection)
PiezoEchoAnalyzer.kt — low-echo detection with prominence-based wall selection
PiezoBVEstimator.kt — Frustum BV estimation with device presets

1:1 port from Swift, same logic, same constants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-21 16:14:07 +09:00
dwjang b83cb16f35 feat: add Piezo BLE data pipeline (1:1 port from iOS)
PiezoPacketCollector.kt:
- Multi-packet reb:/red:/raa: assembly
- Auto-detect Big/Little Endian
- First channel locks endianness for all channels
- 6-channel support (maa command)

BleManager.kt:
- sendAllChannels(mode) → maa command
- reb:/rer:/raa: response routing to piezoCollector
- piezoCollector instance added

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-21 16:06:42 +09:00
dwjang dc61e1d52e i18n: add Korean/English localization via strings.xml
Replace hardcoded Korean UI strings in Piezo, CatheterizeSheet,
VoidingDiary, and UrineCameraScreen with stringResource() calls.
Add values/strings.xml (English) and values-ko/strings.xml (Korean).
System language setting now controls app language.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 11:27:32 +09:00
dw.jang 0e186234d2 UX: 수기 입력 기본값을 현재 추정 용량(estimatedVolume)으로 설정
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 09:34:02 +09:00
dw.jang 0e13f2bbb6 feat: consent screen, reminder system, medical metrics, sex field, design tokens, code quality
A. Reminder: ReminderService (AlarmManager chain), ReminderSettingsView,
   bell icon in Piezo top bar, reschedule on catheterization
B. Consent: ConsentView (3 mandatory items), onboarding→consent→registration flow,
   persistent consent storage, sex field in User + Registration Step 2
C. Diary: 24hUV, NUV, NPI, max capacity, day/night frequency metrics card
D. Design: DesignTokens.kt, 48dp touch targets, DonutChart semantics, pressScale modifier
E. Quality: BuildConfig.DEBUG log wrapping, DateFormatter caching, background I/O for diary store

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 14:26:02 +09:00
dw.jang 1d5c6f15f8 UX: Piezo compact icon buttons 36dp → 44dp (minimum touch target)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 15:00:46 +09:00
dw.jang 65d5d81e9c UX fix: delete button touch target 24dp → 48dp (default IconButton)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 14:52:24 +09:00
dw.jang e142b55063 Fix camera screen: navigate via AppScreen instead of overlay
Camera was hidden behind PiezoMonitoringView because it was rendered
as a child composable. Now uses AppScreen.URINE_CAMERA for full
Crossfade navigation — camera gets its own screen transition.

Flow: Catheterize → 카메라 → AppScreen.URINE_CAMERA → measure → back to PIEZO_MONITORING

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 14:21:00 +09:00
dw.jang 333df201f9 Fix: use AlertDialog for input selection + direct voice/manual dialogs
Replace ModalBottomSheet-based flow with AlertDialog:
- Catheterize → AlertDialog with 3 buttons (수기/음성/카메라)
- 수기: AlertDialog with number TextField + save
- 음성: AlertDialog with auto-start SpeechRecognizer + auto-save
- 카메라: showUrineCamera directly

VoidingDiaryView: sort date groups descending (newest first)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 14:07:05 +09:00
dw.jang b4279d7698 Fix tab switching in CatheterizeSheet + camera launch timing
CatheterizeSheet:
- Replace OutlinedButton with filled Button for tab selection
- Selected tab: filled color, unselected: 10% opacity background
- Tabs now reliably switch between 수기/음성/카메라
- Camera tab directly calls onCameraRequested + onDismiss

PiezoMonitoringView:
- Fix camera launch: use pendingCamera + LaunchedEffect
  to ensure ModalBottomSheet fully closes before camera opens
- Prevents state race condition between sheet dismiss and camera show

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 13:06:38 +09:00
dw.jang ada507f4b4 Add voiding diary view + home icon navigation
VoidingDiaryView:
- Date-grouped record list (grouped by day)
- Shows volume/awake/sleep with icons and colors
- Method badge (수기/음성/카메라)
- Delete with confirmation dialog
- Total record count footer

Navigation changes:
- Piezo screen: ArrowBack → Home icon (집 아이콘)
- Piezo screen: 배뇨일지 icon (Description) added next to home
- NIRS screen: ArrowBack → Home icon
- AppScreen.VOIDING_DIARY route added to Crossfade navigation
- VoidingDiaryView navigates back to HOME

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 12:25:56 +09:00
dw.jang 78552ae784 Add urine cup camera screen with YOLO auto-capture + V2 measurement
UrineCameraScreen:
- YOLO real-time cup detection with green border indicator
- Auto-capture: 2s continuous detection (≥90%) triggers shutter
- Manual shutter button fallback
- V2 SimpleMeasureService analysis (OCR + 3-zone gradient)
- Auto-analyze after capture
- Result display with volume (ml)
- Save to local VoidingRecordStore + toast confirmation
- Retake option on failure
- Brightness guide text

PiezoMonitoringView:
- Camera tab in CatheterizeSheet now opens UrineCameraScreen
- Full-screen overlay for camera (doesn't leave Piezo screen)
- Auto bladder reset on successful measurement

Complete Catheterize flow:
  Catheterize → [수기/음성/카메라] → 입력 → "등록되었습니다" → 레벨 리셋

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:59:21 +09:00
dw.jang c15fcfccca Integrate voiding diary into Piezo catheterization flow
Catheterize button now opens a voiding record sheet with 3 input modes:
- Manual: number TextField (1-1000ml)
- Voice: SpeechRecognizer + VolumeParser (Korean/English)
- Camera: placeholder for YOLO cup measurement (TODO)

On save: "배뇨일지에 등록되었습니다" toast, bladder level resets to 0

New modules (from Uridiary):
- measure/: SimpleMeasureService, YoloDetector, CCPosition, VoidingRecord
- speech/: SpeechRecognizerManager, VolumeParser, HfVolumeExtractor
- assets/urinecup_best.onnx: YOLO model for cup detection

VoidingRecordStore: local SharedPreferences+JSON storage for voiding records

Dependencies added: ONNX Runtime, ML Kit OCR, CameraX, OkHttp
Permissions added: CAMERA, RECORD_AUDIO, INTERNET

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:47:59 +09:00
dw.jang 064f1d1f8d fix: disable dark mode and dynamic color to fix Samsung foldable display issues
Force light theme only, block Samsung Force Dark Mode via forceDarkAllowed=false,
and add explicit text colors to prevent invisible text on light backgrounds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 11:48:51 +09:00
dw.jang e6334f067a feat: add custom app icon with bladder drop, pulse wave, and BLE signal
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 10:25:51 +09:00
dw.jang 76dbf5fe12 feat: responsive layout for foldable phones (compact < 400dp)
Reduce padding, icon sizes, and chart dimensions on narrow screens.
Hide title text and battery % in compact mode to prevent top bar
overflow. Scale donut chart 240→180dp and SpO2 text 56→40sp.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 10:36:53 +09:00
dw.jang 9feaae1939 feat: add demo mode for testing without BLE device
Add "Demo Mode" button in device scan screen that bypasses BLE
connection and calibration. NIRS monitoring generates simulated
random data at 4Hz. Both monitoring views show DEMO badge in top bar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 10:16:59 +09:00
dw.jang 99c58382b4 feat: add X/Y axis labels and grid lines to NIRS charts
Y-axis shows data range with 5 tick labels, X-axis shows elapsed time
in seconds, horizontal grid lines for readability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:21:16 +09:00
dw.jang 3c8de65dab fix: prevent BLE freeze on NIRS streaming stop
Clear mcj callback immediately on stop to prevent stale responses from
triggering new polling chains. Delay battery polling resume by 500ms to
avoid command collision with in-flight mcj response. Add sendNirsPowerOff
for future use.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 11:33:57 +09:00
dw.jang 254381dbaa feat: BLE stability fixes, NIRS streaming improvements, catheter count feature
- Fix BLE API deprecation warnings with API 33+ version checks
- Move isServiceReady to onDescriptorWrite for reliable CCCD setup
- Fix battery polling: immediate query on connect, pause during NIRS streaming
- Add mcj retry mechanism for NIRS streaming reliability
- Add debug logging to BLE, NIRS parsing, and processing pipeline
- Add catheter count feature to Piezo monitoring (persistent count, add dialog, auto-decrement on catheterize)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 11:26:36 +09:00
dw.jang 91c5e5e7e0 fix: NIRS connection failure 2026-03-09 17:36:47 +09:00
dw.jang a8532917b4 Initial commit: VesiscanBasic Android app
Port of MedilightV2 iOS app to Android with Kotlin + Jetpack Compose.
Includes BLE connectivity, NIRS/Piezo sensor modes, Rive animations,
interactive measurement history charts, and foldable device support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:27:00 +09:00