Commit Graph

43 Commits

Author SHA1 Message Date
dw.jang 414ce940a2 fix: maa 1초 throttle — BLE 계층에서 이중 전송 물리 차단
handler.post로 isMeasuring 갱신해도 Compose state 레이스 해결 안 됨.
BleManager에서 lastMaaSentMs 타임스탬프로 1초 이내 재전송 무조건 차단.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-08 12:27:58 +09:00
dw.jang 54bca199af fix: maa 이중 전송 방지 (BV_FAIL 근본 원인)
- isMeasuring=false를 handler.post로 메인 스레드 갱신
  (Thread 내 설정 → Compose state 지연 → 다음 measure() 통과 → maa 이중 전송)
- measure() 진입 시 isMeasuring 가드 추가 (중복 호출 방어)
- 채널 수신 로그 추가 (RECEIVED N channels)
- MTU 247 negotiation 추가 (reb: 208B 분할 전송 최소화)
- Spot 6ch 필터 추가 (allChannelsReceived)
- Auto Stop 시 값 유지 (재계산 안 함)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-08 11:59:13 +09:00
dw.jang 258bad9a26 feat: Foreground Service + Detachment 개선 + Placement 가이드 모드
Foreground Service (BleForegroundService.kt):
- BLE 연결 시 자동 시작, 해제 시 자동 중단
- PARTIAL_WAKE_LOCK (최대 4시간)
- Notification: "VesiScan - BLE 기기 연결 중..."
- connectedDevice foregroundServiceType
- Doze 모드에서도 BLE 통신 유지
- keepScreenOn도 유지 (추가 안전장치)

Detachment 개선:
- THR_MEAN/STD 100→30 (완전 탈착만 감지, 거리 약화 무시)
- 6채널 모두 수신됐을 때만 체크 (BLE 거리 문제와 구분)
- Placement: if(false) 제거 → 활성화 + "센서가 부착되지 않았습니다"
- Monitoring: 정상 복귀 시 LED OFF

Placement 가이드 모드:
- Simple (기본): 3+채널 → 바로 좌우 (기존)
- Boundary: 올라갔다 내려오기 패턴 (경계 감지 → 최적점 복귀)
- 설정 톱니바퀴에 Simple/Boundary 스위치

BLE 로그:
- 역순 표시 (최신이 위) — 스크롤 위치 유지

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-04 16:09:54 +09:00
dw.jang 85162669e4 fix: BLE 패킷 수신 메인스레드 의존 제거 + Auto 간격 1.5초
BLE:
- onCharacteristicChanged에서 handler.post 제거
- processReceivedData를 Binder 스레드에서 직접 실행
- 메인 스레드 큐 대기로 인한 reb 패킷 유실 방지

Auto:
- 최소 간격 1000ms → 1500ms (기기 연속 maa 채널 드롭 방지)
- 10개 × 1.5초 = ~15초마다 trimmed mean 업데이트

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 10:37:14 +09:00
dw.jang 1a42fe6a07 fix: 분석 백그라운드 Thread, 그래프 빈칸 표시, CSV 세션별 분리
성능:
- 측정 콜백 분석(TGC/Otsu/BV)을 백그라운드 Thread로 이동
- UI 업데이트만 handler.post로 메인 스레드 복귀
- 메인 스레드 블로킹으로 인한 BLE 패킷 드롭 방지
- 분석 소요시간 로그 출력 (Analysis took Xms)
- Toast도 handler.post로 감싸서 Thread-safe

Placement:
- 6채널 그래프: 데이터 없는 채널도 "No data" 빈 칸 표시 (항상 6칸)

CSV:
- 일별 파일 → 세션별 파일 (YYYY-MM-DD_HHmmss.csv)
- BLE 연결 시 자동 newSession()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 10:04:03 +09:00
dw.jang c6e84bd6c0 fix: watchdog heartbeat, 배터리 계산, placement 디바운스+방향 수정
BLE:
- watchdog idle heartbeat: 10초 무통신 시 IMU query로 keepalive
- 배터리: 3500-3700mV→0-5%, 3700-4100mV→5-100%, 증가 무시
- 배터리 표시: 아이콘→퍼센트 숫자 (색상 유지)

Placement:
- 힌트 디바운스: 같은 phase 2회 연속일 때만 변경 (깜빡임 방지)
- 방향 힌트 반전: CH3만 잡힘→아래로↓, CH0만 잡힘→위로↑

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 17:27:32 +09:00
dw.jang 5cdae8a86e fix+UX: BLE 중복수신 수정, peak detection 개선, UI 대폭 정리
BLE:
- GATT 다중연결 race condition 수정 (reconnectConnecting 플래그)
- onCharacteristicChanged API 레벨 분기 (dual callback 방지)
- DeviceScan: isConnected → isServiceReady 전환 (서비스 준비 후 화면전환)
- Placement: mpa/maa 500ms 딜레이 (power on 대기)
- Disconnect & Unbond 기능 추가 (msr? + removeBond + 저장정보 삭제)
- autoConnect 삭제 (HomeView)

Algorithm:
- 후위벽 피크 >= threshold 조건 추가 (false positive 차단)
- low-echo 분석범위 80샘플 제한 (뒤쪽 노이즈 무시)
- urineLen: post-ant-1 → post-ant 수정
- Placement: UrinAI fallback 제거 (PiezoEchoAnalyzer만 사용)
- 기기 프리셋 autoDetect index 7→8 수정 (VBT26040Nxx)
- dps 기본값 1.771 → 1.968

UI:
- 도넛차트: Home버튼 삭제, Auto/Catheter count/History 삭제
- 3버튼 레이아웃 (Catheterize/Auto/Spot)
- 배터리 아이콘 (60+초록/30+주황/빨강) + 설정 톱니바퀴 분리
- SensorSelect/Consent 페이지 스킵
- 온보딩: VesiScan-Basic, NIRS 페이지 삭제
- MaxVolume: Step 표시 삭제, mL 오른쪽 배치
- BackHandler 전체 재정리 (자연스러운 뒤로가기)
- BLE 신호 기준 완화 (Good≥-80, Fair≥-90)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 17:03:37 +09:00
dw.jang 227480af4b feat: UI 일괄 수정 (5,6,7,8번)
5. Onboarding 간소화: 4단계→1단계 (Max Volume만)
   Step 1(자세)/2(위치)/4(최적화) 제거, Continue 바로 완료

6. 자동 reconnect: 앱 시작 시 마지막 기기에 자동 연결
   SharedPreferences에 address+name 저장, HomeView에서 autoConnectLastDevice()

7. Demo 모드: DeviceScanView에서 Demo 버튼 제거

8. Android 뒤로가기: BackHandler로 화면별 네비게이션 매핑
   Placement→Home, Monitoring→Placement, History/Diary→Monitoring 등

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 11:41:22 +09:00
dw.jang 9d171f0e06 fix: 배터리 연결 시 1회만 측정 (반복 폴링 없음)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 18:25:18 +09:00
dw.jang 953e6b56aa fix: 배터리 폴링(5초 msn) 제거 — 측정 간섭 방지
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 18:24:27 +09:00
dw.jang 737eaa1a32 fix: mcs 명령 제거 (avg=10이 echo detection 방해 가능성 — 기기 기본값 사용)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 17:58:26 +09:00
dw.jang 26d5ae20fd fix: mcs avg=10으로 설정 (freq=2, cycles=5, avg=10, delay=20, samples=140)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 17:53:52 +09:00
dw.jang 4045ae5198 fix: 연결 시 mcs avg=3 복원 (이전 avg=10 설정이 기기에 남아있음)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 17:45:37 +09:00
dw.jang fecb02dfde fix: Endian 감지 간헐적 실패 수정 (19회 중 5회 ADC 값 폭발)
근본 원인: CH0 첫 샘플이 LE/BE 둘 다 4095 이하일 때
  감지 불가 → LE로 잘못 판정 → 전체 채널 값 폭발 (30000~65000)

수정:
- 확실한 경우: 기존 로직 유지 (LE>4095→BE, BE>4095→LE)
- 애매한 경우: forceBigEndian 기본값 사용
- VBT* 기기: forceBigEndian=true (기기 연결 시 자동 설정)
- 2025MEDIP: forceBigEndian=false
- Endian 결정 로그 추가

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 12:09:57 +09:00
dw.jang 208de17152 fix: 모든 BLE 명령어를 테스터 exe와 동일 포맷으로 통일
테스터(vsbtester) buildPacket() 분석 결과:
- 파라미터 있는 명령: 16비트 Big Endian (buildCommandBE)
- 파라미터 없는 명령: 공백 0x20 추가 (buildCommandASCII " ")

변경:
- mpa, mec, msn, mta, mls → buildCommandBE (BE 파라미터)
- mps, maa, mqq, mag, mcj, mid, msp, mbb → buildCommandASCII " " (공백)
- maa sendChannelsOnly도 공백 방식으로 통일 (기존 LE [0] 제거)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 16:42:02 +09:00
dw.jang fdc4047c5c fix: mls LED 명령 Big Endian 파라미터로 변경 (테스터 exe와 동일)
테스터 코드 분석 결과:
  exe: mls? + [0x00, 0x05] (16비트 Big Endian) → LED 바뀜
  앱: mls? + [0x05, 0x00] (16비트 Little Endian) → LED 안 바뀜

CRC16.buildCommandBE() 추가: 파라미터를 Big Endian으로 직렬화
sendLedMode(): buildCommandBE("mls", [state]) 사용

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 16:38:35 +09:00
dw.jang 3cebaff6a0 fix: mls 명령 포맷 'mls? 5' (공백+ASCII) 시도
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 16:28:29 +09:00
dw.jang e6e9c296f2 fix: mls LED 명령 ASCII 포맷으로 변경 (buildCommand→buildCommandASCII)
기존: mls? + [0x05, 0x00] (2바이트 LE 파라미터) → LED 안 바뀜
변경: mls?5 (ASCII 숫자) → exe 프로그램과 동일 포맷

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 16:04:44 +09:00
dw.jang 76ec271352 fix: msp/mbb 명령어 뒤에 공백 추가 (mid?와 동일 포맷)
기기가 파라미터 없는 명령에도 공백을 요구함 (펌웨어 파서 특성)
- sendImuQuery: buildCommand("msp") → buildCommandASCII("msp", " ")
- sendFullMeasurement: buildCommand("mbb") → buildCommandASCII("mbb", " ")
- IMU 1초 쿼리 재활성화

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 13:49:30 +09:00
dw.jang 9842644e23 fix: mbb 측정 복원 — PiezoPacketCollector가 rbb: 헤더를 skip하도록 수정
근본 원인: mbb? 응답에서 rbb: 헤더가 먼저 오는데 collector가 모르고 무시
→ onMultiChannelComplete 콜백 안 불림 → isMeasuring 영구 true → 버튼 비활성화

수정:
- PiezoPacketCollector.addPacket(): rbb: prefix 인식 → skip + 로그
- BleManager: rbb: 수신 시 piezoCollector.addPacket()에도 전달
- PiezoMonitoringView: sendChannelsOnly→sendFullMeasurement(mbb) 복원

흐름: mbb? → rbb:(skip) → reb:×6(수집) → raa:(완료) → 콜백 정상

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 12:14:27 +09:00
dw.jang bf2f16b207 fix: Spot 측정 mbb→maa 복원 (rbb 헤더가 collector 혼동 유발)
mbb 응답(rbb:→reb:×6→raa:)에서 rbb: 헤더가 piezoCollector를
혼동시켜 그래프가 안 뜨는 문제 발생.

- Spot 단일 측정: sendChannelsOnly(maa) 사용
- 자동 측정 10초째: measure()→maa 사용 (mbb는 파싱 검증 후 전환)
- IMU 전송 시 isMeasuring 체크 추가 (측정 중 충돌 방지)
- sendChannelsOnly() 함수 추가 (기존 sendAllChannels와 동일)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 12:09:02 +09:00
dw.jang af6071e18b fix: mid? 명령 포맷 변경 — buildCommandASCII("mid", " ") 공백 포함
기기에서 rxs:mid? (unknown command) 응답 → 포맷 문제 가능성
buildCommand("mid") → buildCommandASCII("mid", " ") 로 변경하여 테스트

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 11:45:47 +09:00
dw.jang eb5affc6b8 feat: 자동측정 IMU 1초 + 전체측정(mbb) 10초 루프
자동측정 변경 (기존: 30초 maa → 신규: 1초 msp + 10초 mbb):
- 1~9초: msp(IMU query) → rsp(accel+gyro) 1초 간격
- 10초째: mbb(전체측정) → rbb(헤더) + reb×6 + raa
- 기존 maa → mbb(sendFullMeasurement)로 전환
- mbb 응답은 rbb: 헤더 후 reb:/raa: 동일 파이프라인

BLE 명령어 추가:
- sendImuQuery(): msp 전송
- sendFullMeasurement(): mbb 전송 (piezoCollector 연동)
- sendLedMode(state): mls 전송

응답 파싱 추가:
- rxs: → "cmd_not_supported" (mid? 미지원 기기 대응)
- rbb: → full measurement header
- rsp: → IMU data

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 11:31:03 +09:00
dw.jang e6e339379b feat: ADC 로그 저장 + 기기정보 mid? + LED 모드 + 무한 3초 reconnect
1. ADC 로그: 측정 완료 시 MeasurementLogService.logMeasurement() 호출
   → 6채널 raw ADC + 채널별 ant/post/score 저장 (JSONL)

2. 기기 정보: 연결 직후 mid? 전송 → rid: 응답 파싱 → 로그 기록
   (HW Version, Serial Number, FW Version 일괄 조회)

3. LED 모드: Placement Guide 연동
   - 스캔 시작 → mls?(5) ALIGN_SEARCHING
   - PASS → mls?(6) ALIGN_COMPLETE
   - 스캔 종료 → mls?(0) OFF

4. Reconnect: 3/5/10초 5회 → 3초 간격 무한 재시도
   (연결됐다가 끊어진 경우, 사용자가 Home 돌아갈 때까지)

5. BLE 로그: mid/mls TX 파싱, rid:/rls: RX 파싱 추가

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 10:55:29 +09:00
dw.jang df42a47d7d feat: BLE 로그에 파싱된 값 추가 (TX 명령어 + RX 응답 의미)
TX: "maa 6ch measure", "msn battery query", "mpa piezo power ON" 등
RX: "rsn battery=3850mV (100%)", "reb 100samples", "raa all-ch complete",
    "rpa piezo ack", "rag gain calibration (24 values)" 등

펌웨어팀에 보낼 때 raw hex 없이도 통신 흐름을 이해할 수 있음

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 15:40:23 +09:00
dw.jang 796bce19a2 cleanup: WATCHDOG_CHECK 디버그 로그 제거 (이벤트성 로그만 유지)
WATCHDOG_STARTED/TIMEOUT/GATT_ERROR/RECONNECT 등 이벤트 로그는 유지.
5초마다 찍히던 WATCHDOG_CHECK/THREAD 상태 로그 제거.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 15:35:19 +09:00
dw.jang a474935e3c fix: GATT 에러로 끊길 때도 자동 reconnect 시작 (핵심 버그 수정)
근본 원인: Android BLE가 disconnect 시 STATUS_DISCONNECTED가 아닌
GATT 에러(status≠0)로 콜백을 보냄. 기존 에러 경로에서는
reconnectAttempt>0일 때만 재연결 → 첫 끊김 시 재연결 안 됨.

수정:
- wasConnected 체크: 이전에 연결됨 + 사용자 disconnect 아님 → 자동 reconnect
- GATT_ERROR 로그 + DISCONNECTED(gatt_error) 로그 기록
- stopBatteryPolling/stopWatchdog 호출 추가
- watchdog: connected=false 감지 시 무한 루프 대신 break

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 15:13:11 +09:00
dw.jang d3006d91dc debug: watchdog Thread 매 체크마다 로그 기록 (WATCHDOG_CHECK)
watchdog이 실제로 돌고 있는지, 어디서 멈추는지 진단용.
매 5초: WATCHDOG_CHECK silence=Xms connected=true/false
interrupt 시: WATCHDOG_THREAD interrupted
flag 종료 시: WATCHDOG_THREAD stopped

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 14:59:07 +09:00
dw.jang c99eb068a5 fix: watchdog GATT close + 로그를 watchdog Thread에서 직접 실행
기존: handler.post 안에서 로그+disconnect → handler 블로킹 시 둘 다 안 됨
변경:
- debugLogger.error() → watchdog Thread에서 직접 호출 (CopyOnWriteArrayList 스레드 안전)
- gatt.disconnect()/close() → watchdog Thread에서 직접 호출 (GATT는 any thread OK)
- UI 업데이트 + reconnect만 handler.post로 전달

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 14:39:54 +09:00
dw.jang 7ab3d878e7 fix: watchdog 누락 경로 수정 + 시작 로그 추가
- CCCD 없는 경로(no CCCD, no RX)에서도 startWatchdog() + startBatteryPolling() 호출
- watchdog 시작 시 WATCHDOG_STARTED 로그 기록 (실제 동작 확인용)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 14:22:40 +09:00
dw.jang 988fbd9dbd fix: watchdog을 별도 Thread로 분리 (handler 블로킹 방지)
기존: handler.postDelayed로 watchdog 실행 → BLE 스택이 handler를
블로킹하면 watchdog도 멈춤 (좀비 상태 감지 불가)

변경: 별도 daemon Thread에서 5초마다 lastRxTimestamp 체크
→ BLE handler가 블로킹되어도 독립적으로 15초 타임아웃 감지
→ 감지 시 handler.post로 메인 스레드에서 forceDisconnectAndReconnect 실행

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 14:09:16 +09:00
dw.jang 9d32d13452 fix: BLE reconnect를 fresh scan→connect 방식으로 변경
기존: connectGatt(autoConnect=true) — Android에서 매우 불안정, 수분 걸림
변경: BLE 스캔으로 기기를 다시 찾은 후 connectGatt(autoConnect=false)로 빠르게 연결

재연결 흐름:
1. watchdog 15초 타임아웃 → forceDisconnectAndReconnect()
2. scheduleAutoReconnect() → 3s/5s/10s 백오프
3. attemptAutoReconnect():
   - BLE 스캔 시작 (기기 이름 or MAC 주소 매칭)
   - 발견 시 즉시 connectGatt(autoConnect=false) → 빠른 연결
   - 8초 스캔 타임아웃 → 다음 attempt
   - 최대 5회 시도 후 실패 처리
4. 모든 단계 BleDebugLogger에 기록

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 14:02:08 +09:00
dw.jang d4e2627efe fix: BLE watchdog — 좀비 연결 감지 + 강제 reconnect
Android BLE가 disconnect 콜백을 안 보내는 경우(좀비 연결) 대응:
- 마지막 RX로부터 15초간 응답 없으면 강제 disconnect → auto reconnect
- processReceivedData()에서 lastRxTimestamp 갱신
- 5초마다 watchdog 체크
- WATCHDOG_TIMEOUT 이벤트 BleDebugLogger에 기록
- 수동 disconnect 시 watchdog 해제

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 12:27:13 +09:00
dw.jang f220cca187 feat: BLE 디버그 로거 — 펌웨어 디버깅용 상세 통신 로그
BleDebugLogger 신규:
- TX/RX 패킷 기록 (타임스탬프 ms, 데이터 크기)
- RSSI 실시간 추적 (5초마다 readRemoteRssi)
- 연결/끊김/재연결 이벤트 + GATT status code
- 패킷 타임아웃, 채널 누락, Endian 감지 로그
- 측정 결과 (volumeMl, lrRatio, validChannels)
- 파일 내보내기 (.log / .jsonl) + 클립보드 복사
- 세션 통계 (TX/RX/ERR/RSSI avg/min/max)

BleManager 연동:
- sendRaw() → TX 로그
- processReceivedData() → RX 로그
- connected/disconnected/reconnecting/reconnectFailed 이벤트
- onReadRemoteRssi 콜백 → RSSI 기록

PiezoMonitoringView:
- Developer Tools 하단에 BLE Debug Panel 추가
- 2초 자동 갱신, 색상 코딩 (TX=파랑, RX=초록, ERR=빨강, RSSI=노랑, CONN=보라)
- 클립보드 복사 / 파일 저장 / 클리어 버튼

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 11:47:36 +09:00
dw.jang 6f5801b4b6 feat: BLE 자동 reconnect + 배터리 폴링 5초 (keep-alive)
- BleManager: 배터리 폴링 30초→5초 (펌웨어 15초 타임아웃 방지, iOS 동일)
- BleManager: 자동 reconnect with 백오프 (3s→5s→10s, 최대 5회)
  - scheduleAutoReconnect() + attemptAutoReconnect()
  - GATT 에러 시에도 백오프 재시도
  - 수동 disconnect 시 자동 reconnect 취소
- PiezoMonitoringView: 끊김 시 즉시 파란 배너(RECONNECTING)
  - 성공 시 배너 자동 숨김 + 배터리 폴링 재시작
  - 5회 실패 시 빨간 배너 + 수동 Reconnect 버튼
  - 측정 중 끊김 → isMeasuring 리셋 + 자동측정 중지

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-22 17:40:00 +09:00
dwjang 5a084ac5a9 feat: auto-detect device preset from BLE name
VBT260400xy → FLAT, VBT260402xy → NEW_CASE2, VBT260403xy → NEW_CASE1
2025MEDIP → LEGACY_5CH

Auto-called on BLE connect. Logged to debug.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-21 17:29:38 +09:00
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 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
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 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