Record PM67 ZPT voltages in UMP logger v3

This commit is contained in:
2026-10-01 16:00:48 +03:00
parent 316dd52f99
commit 1ce42a1877
4 changed files with 77 additions and 24 deletions

View File

@@ -43,6 +43,8 @@ static unsigned int ump_bank, ump_archive_bank = 1;
static unsigned int ump_archive_count, ump_archive_next, ump_generation;
static unsigned int ump_source, ump_post, ump_post_dropped;
static unsigned int ump_can_header, ump_can_data[3], ump_can_count;
/* Latest PM67 sums: register 306 (index 305), register 9 (index 8). */
static unsigned int ump_pm67_voltage[2];
static unsigned int ump_prev_commands, ump_prev_inputs, ump_prev_outputs;
extern int CanTimeOutErrorTR;
/* Äèàãíîñòèêà âíóòðåííèõ ïåðåìåííûõ ðàçãîíà. Îáíîâëÿåòñÿ ñàìèì Load_runner,
@@ -113,6 +115,7 @@ static void ump_capture(unsigned int reason)
p[31] = ump_dac_ramp; p[32] = ump_dac_duration;
p[33] = ump_dac_go10; p[34] = ump_dac_stop10; p[35] = ump_dac_position;
for (i = 0; i < 4; i++) p[36+i] = ADC_table[i];
p[40] = ump_pm67_voltage[0]; p[41] = ump_pm67_voltage[1];
ump_prev_commands = commands; ump_prev_inputs = p[4]; ump_prev_outputs = p[5];
ump_next++;
if (ump_next == UMP_LOG_CAPACITY) ump_next = 0;
@@ -161,9 +164,20 @@ void ump_log_io(void)
* íîâûå êîìàíäû, à òàêæå èñõîäíûé àäðåñ/ìàñêó è âñå òðè ñëîâà êàäðà. */
void ump_log_can(unsigned int header, unsigned int a, unsigned int b, unsigned int c)
{
unsigned int saved;
if (ump_state != 1 || Desk != dsk_LOAD) return;
unsigned int saved, i, address, mask, data[3];
if (Desk != dsk_LOAD) return;
saved = __disable_interrupts();
data[0] = a; data[1] = b; data[2] = c;
address = header & 0x1FFFU;
mask = 0x8000U;
/* Track reception even while recording is stopped. Each mask bit
* refers to its own address, including disabled words in between. */
for (i = 0; i < 3; i++, address++, mask >>= 1) {
if (!(header & mask)) continue;
if (address == 305U) ump_pm67_voltage[0] = data[i];
if (address == 8U) ump_pm67_voltage[1] = data[i];
}
if (ump_state != 1) { __restore_interrupts(saved); return; }
ump_can_header = header;
ump_can_data[0] = a; ump_can_data[1] = b; ump_can_data[2] = c;
ump_can_count++;
@@ -227,7 +241,7 @@ unsigned int ump_log_read(unsigned int address)
unsigned long first;
switch (address) {
case UMP_LOG_BASE: return 0x554D;
case UMP_LOG_BASE+1: return 2;
case UMP_LOG_BASE+1: return 3;
case UMP_LOG_BASE+2: return ump_source ? 3 : ump_state;
case UMP_LOG_BASE+3: return ump_source ? ump_archive_count : ump_count;
case UMP_LOG_BASE+4: return UMP_LOG_WORDS;
@@ -250,7 +264,7 @@ unsigned int ump_log_read(unsigned int address)
/* Ïîñëåäíèå òðè çàïèñè äëÿ îíëàéí-ãðàôèêà, áåç îñòàíîâêè è áåç
* èçìåíåíèÿ êóðñîðà àðõèâíîãî ÷òåíèÿ. Ïåðâûå äâà ñëîâà — èõ íîìåð. */
if (address >= UMP_LOG_LIVE && address < UMP_LOG_LIVE+124) {
count = ump_count < 3 ? ump_count : 3;
count = ump_count < UMP_LOG_LIVE_RECORDS ? ump_count : UMP_LOG_LIVE_RECORDS;
first = ump_sequence - count;
offset = address - UMP_LOG_LIVE;
if (offset == 0) return (unsigned int)first;