Files
AUTOM/workspace/AUTOM10/Core/Src/eeprom.c

581 lines
15 KiB
C
Raw Permalink Normal View History

2026-05-02 13:05:31 +02:00
#include <stdio.h>
#include <string.h>
2025-12-07 21:39:26 +01:00
#include "eeprom.h"
2026-05-14 19:44:46 +02:00
#include "pwm.h"
2026-05-02 13:05:31 +02:00
extern UART_HandleTypeDef huart1;
2025-12-07 21:39:26 +01:00
/*
* Record format (4 bytes):
* [0] VirtAddress (uint16_t)
* [2] Data (uint16_t)
*
* Page layout:
* [0] PageStatus (uint16_t)
* [2..] Records...
*/
2026-04-15 23:12:13 +02:00
extern uint16_t m1pwmap;
extern uint16_t m1pwmch;
extern uint16_t m2pwmap;
extern uint16_t m2pwmch;
extern uint16_t m3pwmap;
extern uint16_t m3pwmch;
extern uint16_t m4pwmap;
extern uint16_t m4pwmch;
2026-05-02 13:05:31 +02:00
extern uint16_t m1TimeoutMan;
extern uint16_t m2TimeoutMan;
extern uint16_t m3TimeoutMan;
extern uint16_t m4TimeoutMan;
2026-04-15 23:12:13 +02:00
extern uint16_t twap;
extern uint16_t tramp;
extern uint16_t t1ch;
extern uint16_t t2ch;
extern uint16_t t3ch;
2026-04-16 20:28:50 +02:00
extern uint16_t t4ch;
2026-04-15 23:12:13 +02:00
extern uint16_t twch;
2026-05-26 04:31:23 +02:00
extern uint16_t tanem;
extern uint16_t thanem;
2026-04-27 22:04:15 +02:00
extern uint16_t trampman;
extern uint16_t m1pwmMan;
extern uint16_t m2pwmMan;
extern uint16_t m3pwmMan;
extern uint16_t m4pwmMan;
2026-05-14 19:44:46 +02:00
extern uint16_t mrampstart[];
2026-04-15 23:12:13 +02:00
2026-05-02 13:05:31 +02:00
extern uint16_t apM1start;
extern uint16_t apM1stop;
extern uint16_t apM2start;
extern uint16_t apM2stop;
extern uint16_t apM3start;
extern uint16_t apM3stop;
extern uint16_t apM4start;
extern uint16_t apM4stop;
extern uint16_t chM1start;
extern uint16_t chM1stop;
extern uint16_t chM2start;
extern uint16_t chM2stop;
extern uint16_t chM3start;
extern uint16_t chM3stop;
extern uint16_t chM4start;
extern uint16_t chM4stop;
2026-05-26 04:31:23 +02:00
extern uint16_t flagPar;
2026-05-02 13:05:31 +02:00
const uint16_t deftab[EE_NUM_VIRTUAL_ADDR]={
2026-04-14 11:52:48 +02:00
40, //m1pwmap
60, //m1pwmch
2026-04-16 20:28:50 +02:00
70, //m2pwmap
70, //m2pwmch
35, //m3pwmap
2026-04-14 11:52:48 +02:00
40, //m3pwmch
40, //m4pwmap
40, //m4pwmch
20, //m1rampstart
20, //m2rampstart
20, //m3rampstart
20, //m4rampstart
2026-05-02 13:05:31 +02:00
230,//m1timeoutman
100,//m2timeoutman
130,//m3timeoutman
300,//m4timeoutman
2026-04-14 11:52:48 +02:00
1, //twap
2026-04-28 21:24:24 +02:00
27, //t1ch
2026-04-16 20:28:50 +02:00
10, //t2ch
30, //t3ch
1, //t4ch
2026-04-15 23:12:13 +02:00
1, //twch
2026-04-14 11:52:48 +02:00
0,
0,
2026-06-16 01:12:52 +02:00
#ifdef TH250
250,//thanem
#endif
#ifdef TH500
500,//thanem
#endif
#ifdef TH1000
1000,//thanem
#endif
#ifdef TH2000
2000,//thanem
#endif
#ifdef T1S
10, //tanem
#endif
#ifdef T2S
20, //tanem
#endif
#ifdef T4S
40, //tanem
#endif
2026-04-27 22:04:15 +02:00
60, //m1pwmMan
70, //m2pwmMan
40, //m3pwmMan
40, //m4pwmMan
50, //trampman
2026-04-15 23:12:13 +02:00
10, //tramp
2026-05-02 13:05:31 +02:00
310, //apM1start;
450, //apM1stop;
30, //apM2start;
2026-07-08 18:14:47 +02:00
340, //apM2stop;
2026-05-18 22:38:08 +02:00
340, //apM3start;
2026-07-08 18:14:47 +02:00
450, //apM3stop;
2026-05-18 22:38:08 +02:00
30, //apM4start;
430, //apM4stop;
2026-05-02 13:05:31 +02:00
10, //chM1start;
2026-05-18 22:38:08 +02:00
320, //chM1stop;
140, //chM2start;
440, //chM2stop;
2026-05-02 13:05:31 +02:00
20, //chM3start;
280, //chM3stop;
2026-05-18 22:38:08 +02:00
40, //chM4start;
440, //chM4stop;
2026-04-29 23:10:16 +02:00
1,
27,
10,
30,
1,
1,
0,
0,
0,
100,
60,
70,
40,
40,
50,
2026-05-27 22:25:12 +02:00
VERSIONE,//flagpar caricamento parametri
2026-04-14 11:52:48 +02:00
};
2025-12-07 21:39:26 +01:00
typedef struct
{
uint16_t VirtAddress;
uint16_t Data;
} EE_Record_t;
/* Active page base address (runtime selected in EE_Init) */
static uint32_t EE_ActivePageBase = EE_PAGE0_BASE;
/* 32 sequential virtual addresses */
const uint16_t EE_VirtAddrs[EE_NUM_VIRTUAL_ADDR] =
{
2026-04-29 23:10:16 +02:00
0x0001, 0x0002, 0x0003, 0x0004,
0x0005, 0x0006, 0x0007, 0x0008,
0x0009, 0x000A, 0x000B, 0x000C,
0x000D, 0x000E, 0x000F, 0x0010,
0x0011, 0x0012, 0x0013, 0x0014,
0x0015, 0x0016, 0x0017, 0x0018,
0x0019, 0x001A, 0x001B, 0x001C,
0x001D, 0x001E, 0x001F, 0x0020,
0x0021, 0x0022, 0x0023, 0x0024,
0x0025, 0x0026, 0x0027, 0x0028,
0x0029, 0x002A, 0x002B, 0x002C,
0x002D, 0x002E, 0x002F, 0x0030,
0x0031, 0x0032, 0x0033, 0x0034,
0x0035, 0x0036, 0x0037, 0x0038,
0x0039, 0x003A, 0x003B, 0x003C,
0x003D, 0x003E, 0x003F, 0x0040
2025-12-07 21:39:26 +01:00
};
/* ========================================================================= */
/* --- Internal helpers ---------------------------------------------------- */
static uint16_t EE_GetPageStatus(uint32_t pageBase)
{
return *(__IO uint16_t *)pageBase;
}
static HAL_StatusTypeDef EE_FlashProgramHalfWord(uint32_t Address, uint16_t Data)
{
HAL_StatusTypeDef status;
HAL_FLASH_Unlock();
status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, Address, Data);
HAL_FLASH_Lock();
return status;
}
static HAL_StatusTypeDef EE_FlashErasePage(uint32_t PageAddress)
{
HAL_StatusTypeDef status;
FLASH_EraseInitTypeDef EraseInit;
uint32_t PageError = 0;
HAL_FLASH_Unlock();
EraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
EraseInit.PageAddress = PageAddress;
EraseInit.NbPages = 1;
status = HAL_FLASHEx_Erase(&EraseInit, &PageError);
HAL_FLASH_Lock();
return status;
}
/* Find first free record address in given page (returns 0 if full) */
static uint32_t EE_FindFreeAddress(uint32_t pageBase)
{
uint32_t addr = pageBase + 2U; /* Skip status word */
uint32_t pageEnd = pageBase + EE_PAGE_SIZE;
while (addr < (pageEnd - sizeof(EE_Record_t) + 1U))
{
uint16_t vaddr = *(__IO uint16_t *)addr;
if (vaddr == 0xFFFFU)
{
/* Empty slot */
return addr;
}
addr += sizeof(EE_Record_t);
}
return 0U; /* No space */
}
2025-12-08 13:48:52 +01:00
/* Find latest value of VirtAddress in a specific page (internal, uses EE_Status) */
/* Find latest value of VirtAddress in a specific page (scan forward) */
2025-12-07 21:39:26 +01:00
static EE_Status EE_FindInPage(uint32_t pageBase, uint16_t VirtAddress, uint16_t *Data)
{
2025-12-08 13:48:52 +01:00
uint32_t addr = pageBase + 2U; // skip status halfword
uint32_t pageEnd = pageBase + EE_PAGE_SIZE;
EE_Status result = EE_NOT_FOUND;
uint16_t lastVal = 0;
2025-12-07 21:39:26 +01:00
if (Data == NULL)
return EE_ERROR;
2025-12-08 13:48:52 +01:00
while (addr <= (pageEnd - sizeof(EE_Record_t)))
2025-12-07 21:39:26 +01:00
{
uint16_t vaddr = *(__IO uint16_t *)addr;
if (vaddr == 0xFFFFU)
{
2025-12-08 13:48:52 +01:00
// First empty slot => no more records in this page
break;
2025-12-07 21:39:26 +01:00
}
2025-12-08 13:48:52 +01:00
uint16_t value = *(__IO uint16_t *)(addr + 2U);
2025-12-07 21:39:26 +01:00
if (vaddr == VirtAddress)
{
2025-12-08 13:48:52 +01:00
lastVal = value; // keep most recent
result = EE_OK;
2025-12-07 21:39:26 +01:00
}
2025-12-08 13:48:52 +01:00
addr += sizeof(EE_Record_t); // move 4 bytes forward
2025-12-07 21:39:26 +01:00
}
2025-12-08 13:48:52 +01:00
if (result == EE_OK)
*Data = lastVal;
return result;
2025-12-07 21:39:26 +01:00
}
2025-12-08 13:48:52 +01:00
2025-12-07 21:39:26 +01:00
/* Format both pages: erase and set PAGE0 as VALID */
static EE_Status EE_Format(void)
{
if (EE_FlashErasePage(EE_PAGE0_BASE) != HAL_OK)
2025-12-08 13:48:52 +01:00
return EE_STATUS_ERROR;
2025-12-07 21:39:26 +01:00
if (EE_FlashErasePage(EE_PAGE1_BASE) != HAL_OK)
2025-12-08 13:48:52 +01:00
return EE_STATUS_ERROR;
2025-12-07 21:39:26 +01:00
if (EE_FlashProgramHalfWord(EE_PAGE0_BASE, EE_PAGE_STATUS_VALID) != HAL_OK)
2025-12-08 13:48:52 +01:00
return EE_STATUS_ERROR;
2025-12-07 21:39:26 +01:00
/* PAGE1 will remain erased (status = 0xFFFF) */
EE_ActivePageBase = EE_PAGE0_BASE;
2025-12-08 13:48:52 +01:00
return EE_STATUS_OK;
2025-12-07 21:39:26 +01:00
}
/* Get the base of the other page */
static uint32_t EE_GetOtherPageBase(uint32_t pageBase)
{
return (pageBase == EE_PAGE0_BASE) ? EE_PAGE1_BASE : EE_PAGE0_BASE;
}
/* Page transfer (garbage collection + new write) */
static EE_Status EE_PageTransfer(uint16_t VirtAddress, uint16_t Data)
{
uint32_t oldBase = EE_ActivePageBase;
uint32_t newBase = EE_GetOtherPageBase(oldBase);
uint32_t addr;
uint16_t value;
EE_Status st;
/* Erase new page */
if (EE_FlashErasePage(newBase) != HAL_OK)
2025-12-08 13:48:52 +01:00
return EE_STATUS_ERROR;
2025-12-07 21:39:26 +01:00
/* Mark new page as RECEIVE */
if (EE_FlashProgramHalfWord(newBase, EE_PAGE_STATUS_RECEIVE) != HAL_OK)
2025-12-08 13:48:52 +01:00
return EE_STATUS_ERROR;
2025-12-07 21:39:26 +01:00
/* Start writing records just after status */
addr = newBase + 2U;
/* For each known virtual variable */
for (uint16_t i = 0; i < EE_NUM_VIRTUAL_ADDR; i++)
{
uint16_t vaddr = EE_VirtAddrs[i];
if (vaddr == VirtAddress)
{
/* Use the new data passed into PageTransfer */
value = Data;
}
else
{
/* Read latest value from old active page */
st = EE_FindInPage(oldBase, vaddr, &value);
2025-12-08 13:48:52 +01:00
if (st != EE_STATUS_OK)
2025-12-07 21:39:26 +01:00
{
/* Variable never written -> skip */
continue;
}
}
/* Write record to new page */
if (EE_FlashProgramHalfWord(addr, vaddr) != HAL_OK)
2025-12-08 13:48:52 +01:00
return EE_STATUS_ERROR;
2025-12-07 21:39:26 +01:00
if (EE_FlashProgramHalfWord(addr + 2U, value) != HAL_OK)
2025-12-08 13:48:52 +01:00
return EE_STATUS_ERROR;
2025-12-07 21:39:26 +01:00
addr += sizeof(EE_Record_t);
if (addr >= (newBase + EE_PAGE_SIZE))
2025-12-08 13:48:52 +01:00
return EE_STATUS_NO_SPACE;
2025-12-07 21:39:26 +01:00
}
/* Erase old page */
if (EE_FlashErasePage(oldBase) != HAL_OK)
2025-12-08 13:48:52 +01:00
return EE_STATUS_ERROR;
2025-12-07 21:39:26 +01:00
/* Mark new page as VALID */
if (EE_FlashProgramHalfWord(newBase, EE_PAGE_STATUS_VALID) != HAL_OK)
2025-12-08 13:48:52 +01:00
return EE_STATUS_ERROR;
2025-12-07 21:39:26 +01:00
/* Update active page */
EE_ActivePageBase = newBase;
2025-12-08 13:48:52 +01:00
return EE_STATUS_OK;
2025-12-07 21:39:26 +01:00
}
/* --- Public API ----------------------------------------------------------- */
/*
* Initialize the EEPROM emulation.
* - Checks page statuses and chooses the active page.
* - If inconsistent or blank, formats pages.
2025-12-08 13:48:52 +01:00
* PUBLIC RETURN TYPE: uint16_t (EE_OK / EE_ERROR / ...)
2025-12-07 21:39:26 +01:00
*/
2025-12-08 13:48:52 +01:00
uint16_t EE_Init(void)
2025-12-07 21:39:26 +01:00
{
uint16_t status0 = EE_GetPageStatus(EE_PAGE0_BASE);
uint16_t status1 = EE_GetPageStatus(EE_PAGE1_BASE);
if ((status0 == EE_PAGE_STATUS_ERASED) && (status1 == EE_PAGE_STATUS_ERASED))
{
/* Fresh device -> format */
2025-12-08 13:48:52 +01:00
return (uint16_t)EE_Format();
2025-12-07 21:39:26 +01:00
}
else if ((status0 == EE_PAGE_STATUS_VALID) && (status1 == EE_PAGE_STATUS_ERASED))
{
EE_ActivePageBase = EE_PAGE0_BASE;
return EE_OK;
}
else if ((status1 == EE_PAGE_STATUS_VALID) && (status0 == EE_PAGE_STATUS_ERASED))
{
EE_ActivePageBase = EE_PAGE1_BASE;
return EE_OK;
}
else
{
/* Any weird or inconsistent state -> reformat */
2025-12-08 13:48:52 +01:00
return (uint16_t)EE_Format();
2025-12-07 21:39:26 +01:00
}
}
/*
* Read a 16-bit variable by its virtual address.
2025-12-08 13:48:52 +01:00
* PUBLIC RETURN: EE_OK / EE_NOT_FOUND / EE_ERROR (as uint16_t)
2025-12-07 21:39:26 +01:00
*/
2025-12-08 13:48:52 +01:00
uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t *Data)
2025-12-07 21:39:26 +01:00
{
2025-12-08 13:48:52 +01:00
EE_Status st;
2025-12-07 21:39:26 +01:00
if (Data == NULL)
return EE_ERROR;
2025-12-08 13:48:52 +01:00
st = EE_FindInPage(EE_ActivePageBase, VirtAddress, Data);
return (uint16_t)st;
2025-12-07 21:39:26 +01:00
}
/*
* Write (append) a 16-bit variable.
* - Writes a new record in the active page.
* - If the page is full, triggers a page transfer (GC).
2025-12-08 13:48:52 +01:00
* PUBLIC RETURN: EE_OK / EE_ERROR / EE_NO_SPACE (as uint16_t)
2025-12-07 21:39:26 +01:00
*/
2025-12-08 13:48:52 +01:00
uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data)
2025-12-07 21:39:26 +01:00
{
uint32_t freeAddr;
EE_Status st;
/* Find free space in active page */
freeAddr = EE_FindFreeAddress(EE_ActivePageBase);
if (freeAddr != 0U)
{
/* Write new record */
if (EE_FlashProgramHalfWord(freeAddr, VirtAddress) != HAL_OK)
return EE_ERROR;
if (EE_FlashProgramHalfWord(freeAddr + 2U, Data) != HAL_OK)
return EE_ERROR;
return EE_OK;
}
/* No space -> page transfer */
st = EE_PageTransfer(VirtAddress, Data);
2025-12-08 13:48:52 +01:00
return (uint16_t)st;
2025-12-07 21:39:26 +01:00
}
2026-04-15 23:12:13 +02:00
2026-05-26 04:31:23 +02:00
void loadDefault(void){
uint8_t i;
char s[100];
uint16_t st;
for(i=0;i<EE_NUM_VIRTUAL_ADDR;i++){
st=EEW_Write(i,deftab[i]);
if (st == EE_OK)sprintf((char*)s,"\ndone %d=%d",i,deftab[i]);
else sprintf((char*)s,"\nee write error %d", st);
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
}
}
2026-04-15 23:12:13 +02:00
void loadEE(void){
2026-05-02 13:05:31 +02:00
char s [200];
2026-07-08 18:14:47 +02:00
m1pwmap=deftab[M1PWMAP];
m1pwmch=deftab[M1PWMCH];
m2pwmap=deftab[M2PWMAP];
m2pwmch=deftab[M2PWMCH];
m3pwmap=deftab[M3PWMAP];
m3pwmch=deftab[M3PWMCH];
m4pwmap=deftab[M4PWMAP];
m4pwmch=deftab[M4PWMCH];
mrampstart[M1-1]=deftab[M1RAMPSTART];
mrampstart[M2-1]=deftab[M2RAMPSTART];
mrampstart[M3-1]=deftab[M3RAMPSTART];
mrampstart[M4-1]=deftab[M4RAMPSTART];
m1TimeoutMan=deftab[M1TIMEOUTMAN];
m2TimeoutMan=deftab[M2TIMEOUTMAN];
m3TimeoutMan=deftab[M3TIMEOUTMAN];
m4TimeoutMan=deftab[M4TIMEOUTMAN];
thanem=deftab[THANEM];
tanem=deftab[TANEM];
m1pwmMan=deftab[M1PWMMAN];
m2pwmMan=deftab[M2PWMMAN];
m3pwmMan=deftab[M3PWMMAN];
m4pwmMan=deftab[M4PWMMAN];
trampman=deftab[TRAMPMAN];
tramp=deftab[TRAMP];
apM1start=deftab[APM1START];
apM1stop=deftab[APM1STOP];
apM2start=deftab[APM2START];
apM2stop=deftab[APM2STOP];
apM3start=deftab[APM3START];
apM3stop=deftab[APM3STOP];
apM4start=deftab[APM4START];
apM4stop=deftab[APM4STOP];
chM1start=deftab[CHM1START];
chM1stop=deftab[CHM1STOP];
chM2start=deftab[CHM2START];
chM2stop=deftab[CHM2START];
chM3start=deftab[CHM3START];
chM3stop=deftab[CHM3STOP];
chM4start=deftab[CHM4START];
chM4stop=deftab[CHM4STOP];
flagPar=deftab[FLAGPAR];
// EEW_Read(M1PWMAP, &m1pwmap);
// EEW_Read(M1PWMCH, &m1pwmch);
// EEW_Read(M2PWMAP, &m2pwmap);
// EEW_Read(M2PWMCH, &m2pwmch);
// EEW_Read(M3PWMAP, &m3pwmap);
// EEW_Read(M3PWMCH, &m3pwmch);
// EEW_Read(M4PWMAP, &m4pwmap);
// EEW_Read(M4PWMCH, &m4pwmch);
//
// EEW_Read(M1RAMPSTART, &mrampstart[M1-1]);
// EEW_Read(M2RAMPSTART, &mrampstart[M2-1]);
// EEW_Read(M3RAMPSTART, &mrampstart[M3-1]);
// EEW_Read(M4RAMPSTART, &mrampstart[M4-1]);
//
// EEW_Read(M1TIMEOUTMAN, &m1TimeoutMan);
// EEW_Read(M2TIMEOUTMAN, &m2TimeoutMan);
// EEW_Read(M3TIMEOUTMAN, &m3TimeoutMan);
// EEW_Read(M4TIMEOUTMAN, &m4TimeoutMan);
//
// EEW_Read(THANEM, &thanem);
// EEW_Read(TANEM, &tanem);
// EEW_Read(M1PWMMAN, &m1pwmMan);
// EEW_Read(M2PWMMAN, &m2pwmMan);
// EEW_Read(M3PWMMAN, &m3pwmMan);
// EEW_Read(M4PWMMAN, &m4pwmMan);
// EEW_Read(TRAMPMAN, &trampman);
// EEW_Read(TRAMP, &tramp);
//
// EEW_Read(APM1START,&apM1start);
// EEW_Read(APM1STOP ,&apM1stop);
// EEW_Read(APM2START,&apM2start);
// EEW_Read(APM2STOP ,&apM2stop);
// EEW_Read(APM3START,&apM3start);
// EEW_Read(APM3STOP ,&apM3stop);
// EEW_Read(APM4START,&apM4start);
// EEW_Read(APM4STOP ,&apM4stop);
// EEW_Read(CHM1START,&chM1start);
// EEW_Read(CHM1STOP ,&chM1stop);
// EEW_Read(CHM2START,&chM2start);
// EEW_Read(CHM2STOP ,&chM2stop);
// EEW_Read(CHM3START,&chM3start);
// EEW_Read(CHM3STOP ,&chM3stop);
// EEW_Read(CHM4START,&chM4start);
// EEW_Read(CHM4STOP ,&chM4stop);
//
// EEW_Read(FLAGPAR ,&flagPar);
2026-05-26 04:31:23 +02:00
2026-05-02 13:05:31 +02:00
sprintf((char*)s,"LoadEE\n");
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
sprintf((char*)s,"\nm1pwmap=%d m1pwmch=%d m2pwmap=%d m2pwmch=%d m3pwmap=%d m3pwmch=%d m4pwmap=%d m4pwmch=%d",m1pwmap,m1pwmch,m2pwmap,m2pwmch,m3pwmap,m3pwmch,m4pwmap, m4pwmch);
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
sprintf((char*)s,"\nm1TimeoutMan=%d m2TimeoutMan=%d m3TimeoutMan=%d m4TimeoutMan=%d ",m1TimeoutMan,m2TimeoutMan,m3TimeoutMan,m4TimeoutMan);
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
sprintf((char*)s,"\ntramp=%d trampman=%d",tramp,trampman);
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
sprintf((char*)s,"\nm1pwmMan=%d m2pwmMan=%d m3pwmMan=%d m4pwmMan=%d",m1pwmMan,m2pwmMan,m3pwmMan,m4pwmMan);
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
2026-05-05 22:47:18 +02:00
sprintf((char*)s,"\napM1start=%d apM1stop=%d chM1start=%d chM1stop=%d",apM1start,apM1stop,chM1start,chM1stop);
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
sprintf((char*)s,"\napM2start=%d apM2stop=%d chM2start=%d chM2stop=%d",apM2start,apM2stop,chM2start,chM2stop);
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
sprintf((char*)s,"\napM3start=%d apM3stop=%d chM3start=%d chM3stop=%d",apM3start,apM3stop,chM3start,chM3stop);
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
sprintf((char*)s,"\napM4start=%d apM4stop=%d chM4start=%d chM4stop=%d",apM4start,apM4stop,chM4start,chM4stop);
HAL_UART_Transmit(&huart1,(uint8_t*) s, strlen(s), HAL_MAX_DELAY);
2026-05-02 13:05:31 +02:00
2026-04-15 23:12:13 +02:00
}