рефакторинг to_float->u2f

и всякое декоративное по модели
This commit is contained in:
2025-11-30 21:22:04 +03:00
parent 854ea6f6c2
commit 0de4aad4ef
16 changed files with 97 additions and 62 deletions

View File

@@ -21,6 +21,7 @@
#include "modbus_holdregs.h"
#include "modbus_inputregs.h"
#include "modbus_devid.h"
#include "upp_main.h"
/* DEFINE DATA FOR MODBUS */
MB_DataStructureTypeDef MB_DATA = {0}; ///< Coils & Registers
@@ -66,10 +67,16 @@ MB_ExceptionTypeDef MB_Check_Address_For_Arr(uint16_t Addr, uint16_t Qnt, uint16
* @details Определение адреса начального регистра.
* @note WriteFlag пока не используется.
*/
MB_ExceptionTypeDef MB_DefineRegistersAddress(uint16_t **pRegs, uint16_t Addr, uint16_t Qnt, uint8_t RegisterType)
MB_ExceptionTypeDef MB_DefineRegistersAddress(uint16_t **pRegs, uint16_t Addr, uint16_t Qnt, uint8_t RegisterType, uint8_t WriteFlag)
{
/* В режиме работа ничего не записываем */
if(upp.workmode == UPP_Work)
{
return ET_ILLEGAL_FUNCTION;
}
/* check quantity error */
if (Qnt > DATA_SIZE)
if (Qnt > MbData_size)
{
return ET_ILLEGAL_DATA_VALUE; // return exception code
}
@@ -125,6 +132,12 @@ MB_ExceptionTypeDef MB_DefineRegistersAddress(uint16_t **pRegs, uint16_t Addr, u
*/
MB_ExceptionTypeDef MB_DefineCoilsAddress(uint16_t **pCoils, uint16_t Addr, uint16_t Qnt, uint16_t *start_shift, uint8_t WriteFlag)
{
/* В режиме работа ничего не записываем */
if(upp.workmode == UPP_Work)
{
return ET_ILLEGAL_FUNCTION;
}
/* check quantity error */
if (Qnt > 2000)
{