Fix warnings reported in #113 (format warnings, differing types)

pull/134/head
Alastair D'Silva 9 years ago
parent 163986afb4
commit 80d9945266
  1. 4
      cmd/cmd.c
  2. 2
      cmd/handlers.c
  3. 2
      esp-link/cgiflash.c
  4. 12
      esp-link/cgioptiboot.c
  5. 2
      esp-link/cgipins.c
  6. 4
      esp-link/cgiservices.c
  7. 2
      esp-link/config.h
  8. 2
      esp-link/main.c
  9. 6
      mqtt/mqtt_cmd.c
  10. 12
      rest/rest.c
  11. 2
      serial/console.c
  12. 6
      syslog/syslog.c

@ -43,7 +43,7 @@ static uint16_t resp_crc;
// Start a response, returns the partial CRC // Start a response, returns the partial CRC
void ICACHE_FLASH_ATTR void ICACHE_FLASH_ATTR
cmdResponseStart(uint16_t cmd, uint32_t value, uint16_t argc) { cmdResponseStart(uint16_t cmd, uint32_t value, uint16_t argc) {
DBG("cmdResponse: cmd=%d val=%ld argc=%d\n", cmd, value, argc); DBG("cmdResponse: cmd=%d val=%d argc=%d\n", cmd, value, argc);
uart0_write_char(SLIP_END); uart0_write_char(SLIP_END);
cmdProtoWriteBuf((uint8_t*)&cmd, 2); cmdProtoWriteBuf((uint8_t*)&cmd, 2);
@ -107,7 +107,7 @@ cmdParsePacket(uint8_t *buf, short len) {
uint8_t *data_ptr = (uint8_t*)&packet->args; uint8_t *data_ptr = (uint8_t*)&packet->args;
uint8_t *data_limit = data_ptr+len; uint8_t *data_limit = data_ptr+len;
DBG("cmdParsePacket: cmd=%d argc=%d value=%lu\n", DBG("cmdParsePacket: cmd=%d argc=%d value=%u\n",
packet->cmd, packet->cmd,
packet->argc, packet->argc,
packet->value packet->value

@ -62,7 +62,7 @@ cmdAddCb(char* name, uint32_t cb) {
os_strncpy(callbacks[i].name, name, sizeof(callbacks[i].name)); os_strncpy(callbacks[i].name, name, sizeof(callbacks[i].name));
callbacks[i].name[CMD_CBNLEN-1] = 0; // strncpy doesn't null terminate callbacks[i].name[CMD_CBNLEN-1] = 0; // strncpy doesn't null terminate
callbacks[i].callback = cb; callbacks[i].callback = cb;
DBG("cmdAddCb: '%s'->0x%lx added at %d\n", callbacks[i].name, cb, i); DBG("cmdAddCb: '%s'->0x%x added at %d\n", callbacks[i].name, cb, i);
return 1; return 1;
} }
} }

@ -30,7 +30,7 @@ static char* ICACHE_FLASH_ATTR check_header(void *buf) {
uint8_t *cd = (uint8_t *)buf; uint8_t *cd = (uint8_t *)buf;
#ifdef CGIFLASH_DBG #ifdef CGIFLASH_DBG
uint32_t *buf32 = buf; uint32_t *buf32 = buf;
os_printf("%p: %08lX %08lX %08lX %08lX\n", buf, buf32[0], buf32[1], buf32[2], buf32[3]); os_printf("%p: %08X %08X %08X %08X\n", buf, buf32[0], buf32[1], buf32[2], buf32[3]);
#endif #endif
if (cd[0] != 0xEA) return "IROM magic missing"; if (cd[0] != 0xEA) return "IROM magic missing";
if (cd[1] != 4 || cd[2] > 3 || (cd[3]>>4) > 6) return "bad flash header"; if (cd[1] != 4 || cd[2] > 3 || (cd[3]>>4) > 6) return "bad flash header";

@ -153,7 +153,7 @@ int ICACHE_FLASH_ATTR cgiOptibootSync(HttpdConnData *connData) {
if (!errMessage[0] && progState >= stateProg) { if (!errMessage[0] && progState >= stateProg) {
char buf[64]; char buf[64];
DBG("OB got sync\n"); DBG("OB got sync\n");
os_sprintf(buf, "SYNC at %ld baud: bootloader v%d.%d", os_sprintf(buf, "SYNC at %d baud: bootloader v%d.%d",
baudRate, optibootVers>>8, optibootVers&0xff); baudRate, optibootVers>>8, optibootVers&0xff);
httpdSend(connData, buf, -1); httpdSend(connData, buf, -1);
} else if (errMessage[0] && progState == stateSync) { } else if (errMessage[0] && progState == stateSync) {
@ -314,7 +314,7 @@ int ICACHE_FLASH_ATTR cgiOptibootData(HttpdConnData *connData) {
float dt = ((system_get_time() - optibootData->startTime)/1000)/1000.0; // in seconds float dt = ((system_get_time() - optibootData->startTime)/1000)/1000.0; // in seconds
uint16_t pgmDone = optibootData->pgmDone; uint16_t pgmDone = optibootData->pgmDone;
optibootInit(); optibootInit();
os_sprintf(errMessage, "Success. %d bytes at %ld baud in %d.%ds, %dB/s %d%% efficient", os_sprintf(errMessage, "Success. %d bytes at %d baud in %d.%ds, %dB/s %d%% efficient",
pgmDone, baudRate, (int)dt, (int)(dt*10)%10, (int)(pgmDone/dt), pgmDone, baudRate, (int)dt, (int)(dt*10)%10, (int)(pgmDone/dt),
(int)(100.0*(10.0*pgmDone/baudRate)/dt)); (int)(100.0*(10.0*pgmDone/baudRate)/dt));
} else { } else {
@ -387,7 +387,7 @@ static bool ICACHE_FLASH_ATTR processRecord(char *buf, short len) {
optibootData->eof = true; optibootData->eof = true;
break; break;
case 0x04: // address case 0x04: // address
DBG("OB address 0x%lx\n", getHexValue(buf+8, 4) << 16); DBG("OB address 0x%x\n", getHexValue(buf+8, 4) << 16);
// program any remaining partial page // program any remaining partial page
if (optibootData->pageLen > 0) if (optibootData->pageLen > 0)
if (!programPage()) return false; if (!programPage()) return false;
@ -435,7 +435,7 @@ static bool ICACHE_FLASH_ATTR programPage(void) {
uint16_t pgmLen = optibootData->pageLen; uint16_t pgmLen = optibootData->pageLen;
if (pgmLen > optibootData->pgmSz) pgmLen = optibootData->pgmSz; if (pgmLen > optibootData->pgmSz) pgmLen = optibootData->pgmSz;
DBG("OB pgm %d@0x%lx\n", pgmLen, optibootData->address); DBG("OB pgm %d@0x%x\n", pgmLen, optibootData->address);
// send address to optiboot (little endian format) // send address to optiboot (little endian format)
#ifdef DBG_GPIO5 #ifdef DBG_GPIO5
@ -525,7 +525,7 @@ static void ICACHE_FLASH_ATTR optibootTimerCB(void *arg) {
return; return;
} }
// time to switch baud rate and issue a reset // time to switch baud rate and issue a reset
DBG("OB no sync response @%ld baud\n", baudRate); DBG("OB no sync response @%d baud\n", baudRate);
setBaud(); setBaud();
serbridgeReset(); serbridgeReset();
progState = stateInit; progState = stateInit;
@ -539,7 +539,7 @@ static void ICACHE_FLASH_ATTR optibootTimerCB(void *arg) {
return; return;
default: // we're trying to get some info from optiboot and it should have responded! default: // we're trying to get some info from optiboot and it should have responded!
optibootInit(); // abort optibootInit(); // abort
os_sprintf(errMessage, "No response in state %s(%d) @%ld baud\n", os_sprintf(errMessage, "No response in state %s(%d) @%d baud\n",
progStates[progState], progState, baudRate); progStates[progState], progState, baudRate);
DBG("OB %s\n", errMessage); DBG("OB %s\n", errMessage);
return; // do not re-arm timer return; // do not re-arm timer

@ -49,7 +49,7 @@ int ICACHE_FLASH_ATTR cgiPinsSet(HttpdConnData *connData) {
int8_t ok = 0; int8_t ok = 0;
int8_t reset, isp, conn, ser; int8_t reset, isp, conn, ser;
bool swap, rxpup; uint8_t swap, rxpup;
ok |= getInt8Arg(connData, "reset", &reset); ok |= getInt8Arg(connData, "reset", &reset);
ok |= getInt8Arg(connData, "isp", &isp); ok |= getInt8Arg(connData, "isp", &isp);
ok |= getInt8Arg(connData, "conn", &conn); ok |= getInt8Arg(connData, "conn", &conn);

@ -66,11 +66,11 @@ int ICACHE_FLASH_ATTR cgiSystemInfo(HttpdConnData *connData) {
"\"name\": \"%s\", " "\"name\": \"%s\", "
"\"reset cause\": \"%d=%s\", " "\"reset cause\": \"%d=%s\", "
"\"size\": \"%s\", " "\"size\": \"%s\", "
"\"id\": \"0x%02lX 0x%04lX\", " "\"id\": \"0x%02X 0x%04X\", "
"\"partition\": \"%s\", " "\"partition\": \"%s\", "
"\"slip\": \"%s\", " "\"slip\": \"%s\", "
"\"mqtt\": \"%s/%s\", " "\"mqtt\": \"%s/%s\", "
"\"baud\": \"%ld\", " "\"baud\": \"%d\", "
"\"description\": \"%s\"" "\"description\": \"%s\""
" }", " }",
flashConfig.hostname, flashConfig.hostname,

@ -13,7 +13,7 @@ typedef struct {
char hostname[32]; // if using DHCP char hostname[32]; // if using DHCP
uint32_t staticip, netmask, gateway; // using DHCP if staticip==0 uint32_t staticip, netmask, gateway; // using DHCP if staticip==0
uint8_t log_mode; // UART log debug mode uint8_t log_mode; // UART log debug mode
int8_t swap_uart; // swap uart0 to gpio 13&15 uint8_t swap_uart; // swap uart0 to gpio 13&15
uint8_t tcp_enable, rssi_enable; // TCP client settings uint8_t tcp_enable, rssi_enable; // TCP client settings
char api_key[48]; // RSSI submission API key (Grovestreams for now) char api_key[48]; // RSSI submission API key (Grovestreams for now)
uint8_t slip_enable, mqtt_enable, // SLIP protocol, MQTT client uint8_t slip_enable, mqtt_enable, // SLIP protocol, MQTT client

@ -149,7 +149,7 @@ void user_init(void) {
rst_info->exccause, rst_info->epc1, rst_info->epc2, rst_info->epc3, rst_info->exccause, rst_info->epc1, rst_info->epc2, rst_info->epc3,
rst_info->excvaddr, rst_info->depc); rst_info->excvaddr, rst_info->depc);
uint32_t fid = spi_flash_get_id(); uint32_t fid = spi_flash_get_id();
NOTICE("Flash map %s, manuf 0x%02lX chip 0x%04lX", flash_maps[system_get_flash_size_map()], NOTICE("Flash map %s, manuf 0x%02X chip 0x%04X", flash_maps[system_get_flash_size_map()],
fid & 0xff, (fid&0xff00)|((fid>>16)&0xff)); fid & 0xff, (fid&0xff00)|((fid>>16)&0xff));
NOTICE("** esp-link ready"); NOTICE("** esp-link ready");

@ -42,7 +42,7 @@ cmdMqttDataCb(MQTT_Client* client, const char* topic, uint32_t topic_len,
const char* data, uint32_t data_len) const char* data, uint32_t data_len)
{ {
MqttCmdCb* cb = (MqttCmdCb*)client->user_data; MqttCmdCb* cb = (MqttCmdCb*)client->user_data;
DBG("MQTT: Data cb=%p topic=%s len=%ld\n", (void*)cb->dataCb, topic, data_len); DBG("MQTT: Data cb=%p topic=%s len=%u\n", (void*)cb->dataCb, topic, data_len);
cmdResponseStart(CMD_RESP_CB, cb->dataCb, 2); cmdResponseStart(CMD_RESP_CB, cb->dataCb, 2);
cmdResponseBody(topic, topic_len); cmdResponseBody(topic, topic_len);
@ -168,7 +168,7 @@ MQTTCMD_Subscribe(CmdPacket *cmd) {
uint32_t qos = 0; uint32_t qos = 0;
cmdPopArg(&req, (uint8_t*)&qos, 4); cmdPopArg(&req, (uint8_t*)&qos, 4);
DBG("MQTT: MQTTCMD_Subscribe topic=%s, qos=%ld\n", topic, qos); DBG("MQTT: MQTTCMD_Subscribe topic=%s, qos=%u\n", topic, qos);
MQTT_Subscribe(client, (char*)topic, (uint8_t)qos); MQTT_Subscribe(client, (char*)topic, (uint8_t)qos);
os_free(topic); os_free(topic);
@ -245,7 +245,7 @@ MQTTCMD_Setup(CmdPacket *cmd) {
cmdPopArg(&req, &callback->dataCb, 4); cmdPopArg(&req, &callback->dataCb, 4);
client->user_data = callback; client->user_data = callback;
DBG("MQTT connectedCb=%lx\n", callback->connectedCb); DBG("MQTT connectedCb=%x\n", callback->connectedCb);
client->cmdConnectedCb = cmdMqttConnectedCb; client->cmdConnectedCb = cmdMqttConnectedCb;
client->cmdDisconnectedCb = cmdMqttDisconnectedCb; client->cmdDisconnectedCb = cmdMqttDisconnectedCb;

@ -252,7 +252,7 @@ REST_Setup(CmdPacket *cmd) {
os_free(client->pCon); os_free(client->pCon);
} }
os_memset(client, 0, sizeof(RestClient)); os_memset(client, 0, sizeof(RestClient));
DBG_REST("REST: setup #%d host=%s port=%ld security=%ld\n", clientNum, rest_host, port, security); DBG_REST("REST: setup #%d host=%s port=%d security=%d\n", clientNum, rest_host, port, security);
client->resp_cb = cmd->value; client->resp_cb = cmd->value;
@ -348,7 +348,7 @@ REST_Request(CmdPacket *cmd) {
// Get client // Get client
uint32_t clientNum = cmd->value; uint32_t clientNum = cmd->value;
RestClient *client = restClient + (clientNum % MAX_REST); RestClient *client = restClient + (clientNum % MAX_REST);
DBG_REST(" #%ld", clientNum); DBG_REST(" #%d", clientNum);
// Get HTTP method // Get HTTP method
uint16_t len = cmdArgLen(&req); uint16_t len = cmdArgLen(&req);
@ -374,7 +374,7 @@ REST_Request(CmdPacket *cmd) {
realLen = cmdArgLen(&req); realLen = cmdArgLen(&req);
if (realLen > 2048) goto fail; if (realLen > 2048) goto fail;
} }
DBG_REST(" bodyLen=%ld", realLen); DBG_REST(" bodyLen=%d", realLen);
// we need to allocate memory for the header plus the body. First we count the length of the // we need to allocate memory for the header plus the body. First we count the length of the
// header (including some extra counted "%s" and then we add the body length. We allocate the // header (including some extra counted "%s" and then we add the body length. We allocate the
@ -393,7 +393,7 @@ REST_Request(CmdPacket *cmd) {
if (client->data) os_free(client->data); if (client->data) os_free(client->data);
client->data = (char*)os_zalloc(headerLen + realLen); client->data = (char*)os_zalloc(headerLen + realLen);
if (client->data == NULL) goto fail; if (client->data == NULL) goto fail;
DBG_REST(" totLen=%ld data=%p", headerLen + realLen, client->data); DBG_REST(" totLen=%d data=%p", headerLen + realLen, client->data);
client->data_len = os_sprintf((char*)client->data, headerFmt, method, path, client->host, client->data_len = os_sprintf((char*)client->data, headerFmt, method, path, client->host,
client->header, realLen, client->content_type, client->user_agent); client->header, realLen, client->content_type, client->user_agent);
DBG_REST(" hdrLen=%d", client->data_len); DBG_REST(" hdrLen=%d", client->data_len);
@ -412,7 +412,7 @@ REST_Request(CmdPacket *cmd) {
espconn_regist_reconcb(client->pCon, tcpclient_recon_cb); espconn_regist_reconcb(client->pCon, tcpclient_recon_cb);
if(UTILS_StrToIP((char *)client->host, &client->pCon->proto.tcp->remote_ip)) { if(UTILS_StrToIP((char *)client->host, &client->pCon->proto.tcp->remote_ip)) {
DBG_REST("REST: Connect to ip %s:%ld\n",client->host, client->port); DBG_REST("REST: Connect to ip %s:%d\n",client->host, client->port);
//if(client->security){ //if(client->security){
// espconn_secure_connect(client->pCon); // espconn_secure_connect(client->pCon);
//} //}
@ -420,7 +420,7 @@ REST_Request(CmdPacket *cmd) {
espconn_connect(client->pCon); espconn_connect(client->pCon);
//} //}
} else { } else {
DBG_REST("REST: Connect to host %s:%ld\n", client->host, client->port); DBG_REST("REST: Connect to host %s:%d\n", client->host, client->port);
espconn_gethostbyname(client->pCon, (char *)client->host, &client->ip, rest_dns_found); espconn_gethostbyname(client->pCon, (char *)client->host, &client->ip, rest_dns_found);
} }

@ -76,7 +76,7 @@ ajaxConsoleBaud(HttpdConnData *connData) {
} }
jsonHeader(connData, status); jsonHeader(connData, status);
os_sprintf(buff, "{\"rate\": %ld}", flashConfig.baud_rate); os_sprintf(buff, "{\"rate\": %d}", flashConfig.baud_rate);
httpdSend(connData, buff, -1); httpdSend(connData, buff, -1);
return HTTPD_CGI_DONE; return HTTPD_CGI_DONE;
} }

@ -406,16 +406,16 @@ syslog_compose(uint8_t facility, uint8_t severity, const char *tag, const char *
tp->tm_year + 1900, tp->tm_mon + 1, tp->tm_mday, tp->tm_year + 1900, tp->tm_mon + 1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec); tp->tm_hour, tp->tm_min, tp->tm_sec);
if (realtime_stamp == 0) if (realtime_stamp == 0)
p += os_sprintf(p, ".%06luZ ", se->tick % 1000000); p += os_sprintf(p, ".%06uZ ", se->tick % 1000000);
else else
p += os_sprintf(p, "%+03d:00 ", flashConfig.timezone_offset); p += os_sprintf(p, "%+03d:00 ", flashConfig.timezone_offset);
} }
// add HOSTNAME APP-NAME PROCID MSGID // add HOSTNAME APP-NAME PROCID MSGID
if (flashConfig.syslog_showtick) if (flashConfig.syslog_showtick)
p += os_sprintf(p, "%s %s %lu.%06lu %lu ", flashConfig.hostname, tag, se->tick / 1000000, se->tick % 1000000, syslog_msgid++); p += os_sprintf(p, "%s %s %u.%06u %u ", flashConfig.hostname, tag, se->tick / 1000000, se->tick % 1000000, syslog_msgid++);
else else
p += os_sprintf(p, "%s %s - %lu ", flashConfig.hostname, tag, syslog_msgid++); p += os_sprintf(p, "%s %s - %u ", flashConfig.hostname, tag, syslog_msgid++);
// append syslog message // append syslog message
va_list arglist; va_list arglist;

Loading…
Cancel
Save