modbus_tcp
remove redundant pc variable
This commit is contained in:
@@ -43,7 +43,6 @@ static err_t modbus_accept(void* arg, struct tcp_pcb* pcb, err_t err);
|
||||
*/
|
||||
static err_t modbus_incoming_data(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err) {
|
||||
uint8_t counter;
|
||||
char* pc;
|
||||
char text[TEXT_LENGTH];
|
||||
uint8_t background_red = 0;
|
||||
uint8_t background_green = 0;
|
||||
@@ -62,10 +61,10 @@ static err_t modbus_incoming_data(void* arg, struct tcp_pcb* pcb, struct pbuf* p
|
||||
LOG_INFO(TAG, "data not null\n");
|
||||
// Process the modbus data
|
||||
tcp_recved(pcb, p->tot_len);
|
||||
pc = (char*)p->payload;
|
||||
|
||||
for (uint16_t i = 0; i < p->tot_len && i < MAX_REG; i++) { // Putting the buffer in the register array
|
||||
registers[i] = pc[i]; // Getting the error "void value not ignored as it ought to be" on this line
|
||||
// Putting the buffer in the register array
|
||||
for (uint16_t i = 0; i < p->tot_len && i < MAX_REG; i++) {
|
||||
registers[i] = ((uint*)p->payload)[i];
|
||||
}
|
||||
|
||||
if (registers[MODBUS_MODE] == MULTIPLE_REG) { // Check if it's a Modbus Write Multiple Registers request (0x10)
|
||||
|
||||
Reference in New Issue
Block a user