aqhome: fixed typos/bugs (in part copy'n'paste errrors)
This commit is contained in:
@@ -16,13 +16,14 @@
|
|||||||
#include <gwenhywfar/list.h>
|
#include <gwenhywfar/list.h>
|
||||||
#include <gwenhywfar/error.h>
|
#include <gwenhywfar/error.h>
|
||||||
#include <gwenhywfar/debug.h>
|
#include <gwenhywfar/debug.h>
|
||||||
|
#include <gwenhywfar/text.h>
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_FLASHDATA_ADDRESS 0 /* 4 bytes */
|
#define AQH_MSG_OFFS_FLASHDATA_ADDRESS 0 /* 4 bytes */
|
||||||
#define AQH_MSG_OFFS_FLASHDATA_DATA 4 /* x bytes */
|
#define AQH_MSG_OFFS_FLASHDATA_DATA 4 /* x bytes */
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_FLASHEND_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHDATA_DATA)
|
#define AQH_MSG_FLASHDATA_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHDATA_DATA)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ GWEN_MSG *AQH_FlashDataMsg_new(uint8_t srcAddr, uint8_t destAddr, uint8_t code,
|
|||||||
*(ptr++)=(addr>>24) & 0xff;
|
*(ptr++)=(addr>>24) & 0xff;
|
||||||
|
|
||||||
for (i=0; i<dataLen; i++) {
|
for (i=0; i<dataLen; i++) {
|
||||||
*(ptr++)=*(dataPtr);
|
*(ptr++)=*(dataPtr++);
|
||||||
}
|
}
|
||||||
|
|
||||||
rv=AQH_NodeMsg_AddChecksum(msg);
|
rv=AQH_NodeMsg_AddChecksum(msg);
|
||||||
@@ -54,7 +55,6 @@ GWEN_MSG *AQH_FlashDataMsg_new(uint8_t srcAddr, uint8_t destAddr, uint8_t code,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,8 +71,8 @@ uint8_t AQH_FlashDataMsg_GetDataLen(const GWEN_MSG *msg)
|
|||||||
uint8_t msgDataLen;
|
uint8_t msgDataLen;
|
||||||
|
|
||||||
msgDataLen=GWEN_Msg_GetUint8At(msg, AQH_MSG_OFFS_ALL_PAYLOAD_LEN, 0);
|
msgDataLen=GWEN_Msg_GetUint8At(msg, AQH_MSG_OFFS_ALL_PAYLOAD_LEN, 0);
|
||||||
if (msgDataLen>AQH_MSG_FLASHEND_MINSIZE)
|
if (msgDataLen>AQH_MSG_FLASHDATA_MINSIZE)
|
||||||
return msgDataLen-AQH_MSG_OFFS_ALL_DATA_BEGIN-AQH_MSG_OFFS_FLASHDATA_DATA;
|
return msgDataLen-6; /* cmd (1), src(1), addr(4) */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ const uint8_t *AQH_FlashDataMsg_GetDataPtr(const GWEN_MSG *msg)
|
|||||||
const uint8_t *ptr;
|
const uint8_t *ptr;
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg);
|
ptr=GWEN_Msg_GetConstBuffer(msg);
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_FLASHEND_MINSIZE)
|
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_FLASHDATA_MINSIZE)
|
||||||
return ptr+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHDATA_DATA;
|
return ptr+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHDATA_DATA;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -92,8 +92,7 @@ const uint8_t *AQH_FlashDataMsg_GetDataPtr(const GWEN_MSG *msg)
|
|||||||
|
|
||||||
void AQH_FlashDataMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
|
void AQH_FlashDataMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_FLASH_READY) &&
|
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_FLASHDATA_MINSIZE) {
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_FLASHEND_MINSIZE)) {
|
|
||||||
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: FLASHDATA %s (data address=0x%04x, data length=%d)\n",
|
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: FLASHDATA %s (data address=0x%04x, data length=%d)\n",
|
||||||
AQH_NodeMsg_GetSourceAddress(msg),
|
AQH_NodeMsg_GetSourceAddress(msg),
|
||||||
AQH_NodeMsg_GetDestAddress(msg),
|
AQH_NodeMsg_GetDestAddress(msg),
|
||||||
|
|||||||
Reference in New Issue
Block a user