radiacode
radiacode copied to clipboard
Event msgbuf decoder is maybe incomplete?
I'll do a PR once I make more sense of this, but looking at the logs from my phone I see that events are decoded like this:
15:11:38.7: == #213 S_MEAS: GRP_Event, +ms = 2731 (2025-04-24 15:11:38.254), CHN_Event = 9, Dose rate alarm 1, CHN_EventChnMsk = 12 -> 103, CHN_Flags = 0x1241, <Dose rate: Alarm 1>, <Count rate: Alarm 2>, Pwr: Accum, Flags = 00001000: Save to database, CHN_DoseRate = 854 nSv/h, CHN_DoseRateErr = 143 -> 14.3%
...
15:11:39.4: == #216 S_MEAS: GRP_Event, +ms = 2831 (2025-04-24 15:11:39.254), CHN_Event = 10, Dose rate alarm 2, CHN_EventChnMsk = 12 -> 103, CHN_Flags = 0x1242, <Dose rate: Alarm 2>, <Count rate: Alarm 2>, Pwr: Accum, Flags = 00001000: Save to database, CHN_DoseRate = 1.68 µSv/h, CHN_DoseRateErr = 103 -> 10.3%
...
23:54:40.3: == #69 S_MEAS: GRP_Event, +ms = 4873 (2025-04-25 23:54:39.932), CHN_Event = 20, Count rate alarm 1, CHN_EventChnMsk = 3 -> 31, CHN_Flags = 0x1141, <Dose rate: Alarm 1>, <Count rate: Alarm 1>, Pwr: Accum, Flags = 00001000: Save to database, CHN_CountRate = 20.1 cps, CHN_CountRateErr = 63 -> 6.3%
...
00:11:41.8: == #49 S_MEAS: GRP_Event, +ms = -231 (2025-04-26 00:11:38.244), CHN_Event = 21, Count rate alarm 2, CHN_EventChnMsk = 3 -> 31, CHN_Flags = 0x1242, <Dose rate: Alarm 2>, <Count rate: Alarm 2>, Pwr: Accum, Flags = 00001000: Save to database, CHN_CountRate = 82 cps, CHN_CountRateErr = 308 -> 30.8%
So there's more in an event than is currently being decoded and that seems to track with the definition of GRP_Event according the the config message...
"GRP_Event": {
"Id": 7,
"FlgMsk": 0x00009000,
"CHN_Event": {"Id": "14", "DType": "2", "RType": "2"},
"CHN_EventChnMsk": {"Id": "15", "DType": "2", "RType": "8", "Expr": "1", "P1": "8", "P2": "7"},
"CHN_Flags": {"Id": "0", "DType": "4", "RType": "8"},
"CHN_CountRate": {"Id": "3", "Sensor": "c10_CsI_C30035", "Unit": " cps| имп/с", "DType": "1", "RType": "1", "MaxVal": "50e3"},
"CHN_CountRateErr": {"Id": "16", "Sensor": "c10_CsI_C30035", "Unit": "%", "DType": "4", "RType": "1", "MinVal": "0", "MaxVal": "50", "Expr": "1", "P1": "0.1"},
"CHN_DoseRate": {"Id": "4", "Sensor": "c10_CsI_C30035", "Unit": " R/h| Р/ч", "ScaledUnit": "1", "DType": "1", "RType": "1", "MaxVal": "1e-1"},
"CHN_DoseRateErr": {"Id": "5", "Sensor": "c10_CsI_C30035", "Unit": "%", "DType": "4", "RType": "1", "MinVal": "0", "MaxVal": "50", "Expr": "1", "P1": "0.1"},
"CHN_Duration": {"Id": "6", "DType": "8", "RType": "8", "Unit": " s| с"},
"CHN_Dose": {"Id": "7", "Sensor": "c10_CsI_C30035", "Unit": " R| Р", "ScaledUnit": "1", "DType": "1", "RType": "1", "MinVal": "1e-6", "MaxVal": "1e3"},
"CHN_Temperature": {"Id": "8", "Sensor": "AS6212-AWLT", "Unit": "°C", "DType": "5", "RType": "1", "MinVal": "-20", "MaxVal": "40", "Expr": "1", "P1": "0.01", "P2": "-20"},
"CHN_ChargeLevel": {"Id": "9", "Sensor": "MCU_ADC", "Unit": "%", "DType": "4", "RType": "1", "MinVal": "0", "MaxVal": "100", "Expr": "1", "P1": "0.01"},
}
I haven't put my radiacode in my freezer or in a very hot enclosure to see if temperature alarms are generated, but they do seem like they exist. Also need to check to see if the event message is a constant size and the android app isn't displaying non-alarming fields (as indicated by EventChnMsk?), or if it's variable length and some fields aren't present at all.