chore: HERV 통합 저장소 초기 커밋
- 펌웨어(program), C# 대시보드(TestProgram), 시뮬레이터(Simulator), 프로토콜/문서(Protocol, doc) 전체를 단일 저장소로 통합 - program 폴더의 별도 git 저장소를 제거하고 통합 저장소에 흡수 - 빌드 산출물(program/build, bin/obj, *.o/.elf/.bin/.hex 등) .gitignore 처리 - 사내 Synology NAS Git 원격 연결 예정 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
using ErvDashboard.Model;
|
||||
using ErvProtocol;
|
||||
|
||||
namespace ErvDashboard.Api
|
||||
{
|
||||
// StatusRecord(공용 프로토콜 디코드 결과) → DashboardState(WPF UI 모델) 매핑.
|
||||
// (이전 DashboardProtocol.ApplyStatus 로직 — API 는 UI 비종속, 매핑은 여기로 분리)
|
||||
public static class StatusMapper
|
||||
{
|
||||
public static void Apply(StatusRecord s, DashboardState state)
|
||||
{
|
||||
state.PowerOn = s.Power != 0;
|
||||
state.RunMode = (RunMode)s.RunMode;
|
||||
state.AutoState = (AutoState)s.AutoState;
|
||||
state.FanMode = s.FanMode;
|
||||
state.SubModeBitmap = s.SubMode;
|
||||
state.Hood = s.HoodEnable; // byte5 bit0 = 연동 Enable
|
||||
state.HoodConnected = s.HoodConnected; // byte5 bit2 = 후드 통신연결
|
||||
state.HystPreset = (HystPreset)s.HystPreset;
|
||||
state.HystPm25 = s.HystPm25;
|
||||
state.HystPm10 = s.HystPm10;
|
||||
state.HystVoc = s.HystVoc;
|
||||
state.HystCo2 = s.HystCo2;
|
||||
state.ErrorCode = s.ErrorCode;
|
||||
state.Reset = s.Reset != 0;
|
||||
state.ReserveRemainSec = s.ReserveRemainSec;
|
||||
|
||||
for (int i = 0; i < state.Vsp.Count && i < s.Vsp.Length; i++)
|
||||
{
|
||||
state.Vsp[i].Sa = s.Vsp[i].Sa;
|
||||
state.Vsp[i].Ea = s.Vsp[i].Ea;
|
||||
}
|
||||
|
||||
for (int i = 0; i < state.HystTable.Count && i < s.HystTable.Length; i++)
|
||||
{
|
||||
state.HystTable[i].Pm25 = s.HystTable[i].Pm25;
|
||||
state.HystTable[i].Pm10 = s.HystTable[i].Pm10;
|
||||
state.HystTable[i].Voc = s.HystTable[i].Voc;
|
||||
state.HystTable[i].Co2 = s.HystTable[i].Co2;
|
||||
}
|
||||
|
||||
// 모드별 오염단계 임계표
|
||||
for (int i = 0; i < 3 && i < s.ThrTable.Length; i++)
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
state.Co2Thr[i][k] = s.ThrTable[i].Co2[k];
|
||||
state.Pm25Thr[i][k] = s.ThrTable[i].Pm25[k];
|
||||
state.Pm10Thr[i][k] = s.ThrTable[i].Pm10[k];
|
||||
state.VocThr[i][k] = s.ThrTable[i].Voc[k];
|
||||
}
|
||||
|
||||
int totalLoad = 0;
|
||||
for (int r = 0; r < 4; r++)
|
||||
{
|
||||
var src = s.Rooms[r];
|
||||
var room = state.Rooms[r];
|
||||
room.DamperSaOpen = src.DamperSa; // 비트맵 bit0
|
||||
room.DamperEaOpen = src.DamperEa; // 비트맵 bit1
|
||||
room.Pm25 = src.Pm25;
|
||||
room.Pm10 = src.Pm10;
|
||||
room.Voc = src.Voc;
|
||||
room.Co2 = src.Co2;
|
||||
room.AirQuality = (AirQuality)src.AirQuality;
|
||||
room.LedDim = src.LedDim;
|
||||
room.LoadScore = src.LoadScore;
|
||||
room.FinalVolume = src.FinalVolume;
|
||||
room.Temp = src.Temp;
|
||||
room.Humi = src.Humi;
|
||||
totalLoad += src.LoadScore;
|
||||
}
|
||||
state.TotalLoadScore = totalLoad; // 합산 부하점수 (0~16)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user