This commit is contained in:
andrey 2025-11-15 19:16:26 +03:00
parent 69ae4f8cf2
commit 0a017eee9f
6 changed files with 33 additions and 28 deletions

View File

@ -433,8 +433,8 @@ FuncStat value_control(void )
{ {
MB_DATA.Coils.coils[0].all |= 1 << i; MB_DATA.Coils.relay_struct_off.all |= 1 << i;
MB_DATA.Coils.coils[1].all &= ~(1 << i); MB_DATA.Coils.relay_struct_on.all &= ~(1 << i);
} }
@ -444,11 +444,19 @@ FuncStat value_control(void )
if (sens[i].temperature > sens[i].set_temp + sens[i].hyst) if (sens[i].temperature > sens[i].set_temp + sens[i].hyst)
{ {
MB_DATA.Coils.coils[0].all &= ~(1 << i); MB_DATA.Coils.relay_struct_off.all &= ~(1 << i);
MB_DATA.Coils.coils[1].all |= 1 << i; MB_DATA.Coils.relay_struct_on.all |= 1 << i;
} }
else
if (sens[i].temperature == sens[i].set_temp )
{
MB_DATA.Coils.relay_struct_on.all &= ~(1 << i);
MB_DATA.Coils.relay_struct_off.all &= ~(1 << i);
}
} }

View File

@ -1,4 +1,4 @@
#include "eeprom_emul.h" //#include "eeprom_emul.h"
#include <string.h> #include <string.h>
// Внутренние переменные // Внутренние переменные

View File

@ -188,37 +188,32 @@
<Ww> <Ww>
<count>7</count> <count>7</count>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>MB_DATA.Coils.relay_struct[0].state_val_bit.Temp10_relay_isOn,0x0A</ItemText> <ItemText>record</ItemText>
</Ww> </Ww>
<Ww> <Ww>
<count>8</count> <count>8</count>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>MB_DATA.Coils.relay_struct[0].state_val_bit.Temp11_relay_isOn,0x0A</ItemText> <ItemText>flash_buff</ItemText>
</Ww> </Ww>
<Ww> <Ww>
<count>9</count> <count>9</count>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>record</ItemText> <ItemText>new_record</ItemText>
</Ww> </Ww>
<Ww> <Ww>
<count>10</count> <count>10</count>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>flash_buff</ItemText> <ItemText>state</ItemText>
</Ww> </Ww>
<Ww> <Ww>
<count>11</count> <count>11</count>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>new_record</ItemText> <ItemText>htim</ItemText>
</Ww> </Ww>
<Ww> <Ww>
<count>12</count> <count>12</count>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>state</ItemText> <ItemText>sens[i].set_temp</ItemText>
</Ww>
<Ww>
<count>13</count>
<WinNumber>1</WinNumber>
<ItemText>htim</ItemText>
</Ww> </Ww>
</WatchWindow1> </WatchWindow1>
<WatchWindow2> <WatchWindow2>
@ -385,7 +380,7 @@
<GroupNumber>2</GroupNumber> <GroupNumber>2</GroupNumber>
<FileNumber>6</FileNumber> <FileNumber>6</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>../Core/Src/main.c</PathWithFileName> <PathWithFileName>../Core/Src/main.c</PathWithFileName>
@ -541,7 +536,7 @@
<Group> <Group>
<GroupName>Drivers/STM32F1xx_HAL_Driver</GroupName> <GroupName>Drivers/STM32F1xx_HAL_Driver</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -561,7 +556,7 @@
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>20</FileNumber> <FileNumber>20</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c</PathWithFileName> <PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c</PathWithFileName>

View File

@ -22,7 +22,7 @@
#include "stm32f1xx_hal.h" #include "stm32f1xx_hal.h"
// Общие параметры // Общие параметры
#define MODBUS_DEVICE_ID 1 ///< Адрес устройства в сети Modbus #define MODBUS_DEVICE_ID 3 ///< Адрес устройства в сети Modbus
#define MODBUS_TIMEOUT 5000 ///< Таймаут в тиках таймера #define MODBUS_TIMEOUT 5000 ///< Таймаут в тиках таймера
// Строковые идентификаторы устройства // Строковые идентификаторы устройства

View File

@ -239,11 +239,14 @@ typedef __PACKED_STRUCT
word coils[3]; //48 word coils[3]; //48
uint16_t reserve1[mb_fill_rsv(128 / 16, word[3])]; uint16_t reserve_coils[mb_fill_rsv(128 / 16, word[3])];
STATUS_TSENS status_tSens[MAX_SENSE / 16]; //32 STATUS_TSENS status_tSens[MAX_SENSE / 16]; //32
uint16_t reserve2[mb_fill_rsv(128 / 16, STATUS_TSENS[MAX_SENSE / 16])]; uint16_t reserve_status_tSens[mb_fill_rsv(128 / 16, STATUS_TSENS[MAX_SENSE / 16])];
RELAY_Struct relay_struct[MAX_SENSE / 16 * 2]; //16 2 реле на 1 датчик RELAY_Struct relay_struct_on; //16 ON
uint16_t reserve3[mb_fill_rsv(128 / 16, RELAY_Struct[MAX_SENSE / 16 * 2])]; uint16_t reserve_relay_struct_on[mb_fill_rsv(32 / 16, RELAY_Struct)];
RELAY_Struct relay_struct_off; //16 OFF
uint16_t reserve_relay_struct_off[mb_fill_rsv(32 / 16, RELAY_Struct)];
uint16_t reserve3[mb_fill_rsv(80 / 16, RELAY_Struct)];
unsigned init_param: 1; //384 unsigned init_param: 1; //384
unsigned init_Tsens: 1; //385 unsigned init_Tsens: 1; //385

View File

@ -86,9 +86,7 @@ typedef __PACKED_STRUCT//MB_DataInRegsTypeDef
{ {
uint16_t sens_Temp[MAX_SENSE]; uint16_t sens_Temp[MAX_SENSE];
uint16_t reserve[mb_fill_rsv(1000, uint16_t[MAX_SENSE])]; uint16_t reserve[mb_fill_rsv(1000, uint16_t[MAX_SENSE])];
DS18B20_Drv_t ID; DS18B20_Drv_t ID;
uint16_t reserve1[mb_fill_rsv(200, DS18B20_Drv_t)]; uint16_t reserve1[mb_fill_rsv(200, DS18B20_Drv_t)];
uint16_t num_Tsens; uint16_t num_Tsens;
@ -244,7 +242,8 @@ typedef __PACKED_STRUCT
uint16_t reserve1[mb_fill_rsv(128 / 16, word[3])]; uint16_t reserve1[mb_fill_rsv(128 / 16, word[3])];
STATUS_TSENS status_tSens[MAX_SENSE / 16]; //32 STATUS_TSENS status_tSens[MAX_SENSE / 16]; //32
uint16_t reserve2[mb_fill_rsv(128 / 16, STATUS_TSENS[MAX_SENSE / 16])]; uint16_t reserve2[mb_fill_rsv(128 / 16, STATUS_TSENS[MAX_SENSE / 16])];
RELAY_Struct relay_struct[MAX_SENSE / 16 * 2]; //16 2 реле на 1 датчик RELAY_Struct relay_struct_on; //16 ON
RELAY_Struct relay_struct_off; //16 OFF
uint16_t reserve3[mb_fill_rsv(128 / 16, RELAY_Struct[MAX_SENSE / 16 * 2])]; uint16_t reserve3[mb_fill_rsv(128 / 16, RELAY_Struct[MAX_SENSE / 16 * 2])];
unsigned init_param: 1; //384 unsigned init_param: 1; //384