Code cleanup to sort out warnings.

I2S constants have changed; docs updated.
This commit is contained in:
Johny Mattsson 2021-07-29 13:47:45 +10:00
parent dff32e8902
commit bc7b923646
21 changed files with 49 additions and 50 deletions

View File

@ -1,3 +1,6 @@
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(nodemcu)
# Useful when tidying up code to catch all the warnings.
#idf_build_set_property(COMPILE_OPTIONS "-Werror" "-Werror=deprecated-declarations" APPEND)

View File

@ -73,9 +73,9 @@ void ip6str (char *out, const ip6_addr_t *ip)
void ipstr_esp (char *out, const esp_ip_addr_t *ip)
{
if (ip->type == ESP_IPADDR_TYPE_V4)
ip4str (out, &ip->u_addr.ip4);
ip4str_esp (out, &ip->u_addr.ip4);
else if (ip->type == ESP_IPADDR_TYPE_V6)
ip6str (out, &ip->u_addr.ip6);
ip6str_esp (out, &ip->u_addr.ip6);
}
void ip6str_esp (char *out, const esp_ip6_addr_t *ip)
@ -92,7 +92,7 @@ void ipstr (char *out, const ip_addr_t *ip)
void ipstr_esp(char *out, const esp_ip_addr_t *ip)
{
ip4str_esp(out, ip);
ip4str_esp(out, &ip->u_addr.ip4);
}
#endif

View File

@ -32,7 +32,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "esp_intr.h"
#include "esp_intr_alloc.h"
#include "soc/dport_reg.h"
#include <math.h>

View File

@ -8,6 +8,3 @@ idf_component_register(
REQUIRES "platform" "uzlib" "driver_console"
PRIV_REQUIRES "base_nodemcu" "embedded_lfs"
)
target_compile_options(${COMPONENT_LIB} PRIVATE
-Wno-error=misleading-indentation
)

View File

@ -849,7 +849,8 @@ LUALIB_API int luaL_loadfsfile (lua_State *L, const char *filename) {
lf.f = vfs_open(filename, "r"); /* reopen in binary mode */
if (!lf.f) return errfsfile(L, "reopen", fnameindex);
/* skip eventual `#!...' */
while ((c = vfs_getc(lf.f)) != VFS_EOF && c != LUA_SIGNATURE[0]) ;
while ((c = vfs_getc(lf.f)) != VFS_EOF && c != LUA_SIGNATURE[0])
;
lf.extraline = 0;
}
vfs_ungetc(c, lf.f);

View File

@ -256,6 +256,7 @@ static int stripdebug (lua_State *L, Proto *f, int level) {
sizepackedlineinfo = strlen(cast(char *, f->packedlineinfo))+1;
f->packedlineinfo = luaM_freearray(L, f->packedlineinfo, sizepackedlineinfo, unsigned char);
len += sizepackedlineinfo;
// fall-through
case 2:
len += f->sizelocvars * (sizeof(struct LocVar) + sizeof(dummy->tsv) + sizeof(struct LocVar *));
f->locvars = luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar);
@ -515,7 +516,7 @@ static Instruction symbexec (const Proto *pt, int lastpc, int reg) {
case OP_FORLOOP:
case OP_FORPREP:
checkreg(pt, a+3);
/* go through */
/* fall-through */
case OP_JMP: {
int dest = pc+1+b;
/* not full check and jump is forward and do not skip `lastpc'? */

View File

@ -360,6 +360,7 @@ static int llex (LexState *ls, SemInfo *seminfo) {
}
else if (sep == -1) return '[';
else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
__builtin_unreachable();
}
case '=': {
next(ls);

View File

@ -621,6 +621,7 @@ const TValue *luaH_get (Table *t, const TValue *key) {
return luaH_getnum(t, k); /* use specialized version */
/* else go through */
}
/* fall-through */
default: {
Node *n = mainposition(t, key);
do { /* check whether `key' is somewhere in the chain */
@ -646,6 +647,7 @@ const TValue *luaH_get_ro (void *t, const TValue *key) {
return luaH_getnum_ro(t, k); /* use specialized version */
/* else go through */
}
/* fall-through */
default: {
return luaO_nilobject;
}

View File

@ -137,7 +137,7 @@ static void addfield (lua_State *L, luaL_Buffer *b, int i) {
if (!lua_isstring(L, -1))
luaL_error(L, "invalid value (%s) at index %d in table for "
LUA_QL("concat"), luaL_typename(L, -1), i);
luaL_addvalue(b);
luaL_addvalue(b);
}

View File

@ -96,6 +96,7 @@ static void print_version (lua_State *L) {
}
#if 0
static int getargs (lua_State *L, char **argv, int n) {
int narg;
int i;
@ -112,6 +113,7 @@ static int getargs (lua_State *L, char **argv, int n) {
}
return narg;
}
#endif
static int dofsfile (lua_State *L, const char *name) {
int status = luaL_loadfsfile(L, name) || docall(L, 0, 1);
@ -200,14 +202,14 @@ static int collectargs (char **argv, int *pi, int *pv, int *pe) {
return i;
case 'i':
notail(argv[i]);
*pi = 1; /* go through */
*pi = 1; /* fall-through */
case 'v':
notail(argv[i]);
*pv = 1;
break;
case 'e':
*pe = 1; /* go through */
case 'm': /* go through */
*pe = 1; /* fall-through */
case 'm': /* fall-through */
case 'l':
if (argv[i][2] == '\0') {
i++;
@ -371,7 +373,7 @@ void donejob(lua_Load *load){
}
static void dojob(lua_Load *load){
size_t l, rs;
size_t l;
int status;
char *b = load->line;
lua_State *L = load->L;

View File

@ -49,8 +49,8 @@ static int check_err (lua_State *L, esp_err_t err)
{
switch (err)
{
case ESP_ERR_INVALID_ARG: luaL_error (L, "invalid argument");
case ESP_ERR_INVALID_STATE: luaL_error (L, "internal logic error");
case ESP_ERR_INVALID_ARG: return luaL_error (L, "invalid argument");
case ESP_ERR_INVALID_STATE: return luaL_error (L, "internal logic error");
case ESP_OK: break;
}
return 0;

View File

@ -151,7 +151,7 @@ static int node_i2s_start( lua_State *L )
i2s_config.bits_per_sample = is->i2s_bits_per_sample;
//
i2s_config.channel_format = opt_checkint(L, "channel", I2S_CHANNEL_FMT_RIGHT_LEFT);
i2s_config.communication_format = opt_checkint(L, "format", I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB);
i2s_config.communication_format = opt_checkint(L, "format", I2S_COMM_FORMAT_STAND_I2S);
i2s_config.dma_buf_count = opt_checkint_range(L, "buffer_count", 2, 2, 128);
i2s_config.dma_buf_len = opt_checkint_range(L, "buffer_len", i2s_config.sample_rate / 100, 8, 1024);
i2s_config.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1;
@ -316,12 +316,10 @@ LROT_BEGIN(i2s)
LROT_FUNCENTRY( write, node_i2s_write )
LROT_FUNCENTRY( mute, node_i2s_mute )
LROT_NUMENTRY( FORMAT_I2S, I2S_COMM_FORMAT_I2S )
LROT_NUMENTRY( FORMAT_I2S_MSB, I2S_COMM_FORMAT_I2S_MSB )
LROT_NUMENTRY( FORMAT_I2S_LSB, I2S_COMM_FORMAT_I2S_LSB )
LROT_NUMENTRY( FORMAT_PCM, I2S_COMM_FORMAT_PCM )
LROT_NUMENTRY( FORMAT_PCM_SHORT, I2S_COMM_FORMAT_PCM_SHORT )
LROT_NUMENTRY( FORMAT_PCM_LONG, I2S_COMM_FORMAT_PCM_LONG )
LROT_NUMENTRY( FORMAT_I2S_STAND, I2S_COMM_FORMAT_STAND_I2S )
LROT_NUMENTRY( FORMAT_I2S_MSB, I2S_COMM_FORMAT_STAND_MSB )
LROT_NUMENTRY( FORMAT_PCM_SHORT, I2S_COMM_FORMAT_STAND_PCM_SHORT )
LROT_NUMENTRY( FORMAT_PCM_LONG, I2S_COMM_FORMAT_STAND_PCM_LONG )
LROT_NUMENTRY( CHANNEL_RIGHT_LEFT, I2S_CHANNEL_FMT_RIGHT_LEFT )
LROT_NUMENTRY( CHANNEL_ALL_LEFT, I2S_CHANNEL_FMT_ALL_LEFT )

View File

@ -4,8 +4,6 @@
#include "module.h"
#include "lauxlib.h"
#define U8X8_USE_PINS
#define U8X8_WITH_USER_PTR
#include "u8g2.h"
#include "u8x8_nodemcu_hal.h"

View File

@ -3,15 +3,10 @@
#include "module.h"
#include "lauxlib.h"
#define USE_PIN_LIST
#include "ucg.h"
#include "ucg_nodemcu_hal.h"
#include "ucg_config.h"
#ifdef ESP_PLATFORM
// ESP32
#include "spi_common.h"
@ -25,7 +20,6 @@
#endif
typedef struct
{
ucg_nodemcu_t ucg;

View File

@ -161,16 +161,6 @@ void wifi_sta_init (void)
}
// --- Helper functions -----------------------------------------------------
static void do_connect (esp_event_base_t base, int32_t id, const void *data)
{
(void)base; (void)id; (void)data;
esp_wifi_connect ();
}
// --- Lua API functions ----------------------------------------------------
static int wifi_sta_setip(lua_State *L)
{

View File

@ -206,8 +206,8 @@ static int onewire_rmt_attach_pin( uint8_t gpio_num )
// attach RMT channels to new gpio pin
// ATTENTION: set pin for rx first since gpio_output_disable() will
// remove rmt output signal in matrix!
rmt_set_pin( ow_rmt.rx, RMT_MODE_RX, gpio_num );
rmt_set_pin( ow_rmt.tx, RMT_MODE_TX, gpio_num );
rmt_set_gpio( ow_rmt.rx, RMT_MODE_RX, gpio_num, false );
rmt_set_gpio( ow_rmt.tx, RMT_MODE_TX, gpio_num, false );
// force pin direction to input to enable path to RX channel
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]);

View File

@ -4,6 +4,5 @@ idf_component_register(
REQUIRES "platform"
)
target_compile_options(${COMPONENT_LIB} PRIVATE
-Wno-error=unused-const-variable
-imacros json_config.h
)

View File

@ -1452,6 +1452,7 @@ static const unsigned short Special_Table[0x80] = {
/* 0x74 */ JSONSL_SPECIALf_TRUE /* <t> */ /* 0x74 */
};
#if 0
// Bit tables are order such that the MSB is bit 0.
//
/**
@ -1486,6 +1487,7 @@ static const char Special_Endings[0x100] = {
/* 0xde */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xfd */
/* 0xfe */ 0 /* 0xfe */
};
#endif
static const uint32_t Special_Endings_bits[0x80 / 32] = {
0b00000000011001000000000000000000,
0b10100000000010000000000000100000,
@ -1493,6 +1495,7 @@ static const uint32_t Special_Endings_bits[0x80 / 32] = {
0b00000000000000000000000000010100
};
#if 0
/**
* This table contains entries for the allowed whitespace as per RFC 4627
*/
@ -1512,8 +1515,10 @@ static const char Allowed_Whitespace[0x100] = {
/* 0xc1 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xe0 */
/* 0xe1 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* 0xfe */
};
#endif
static const uint32_t Allowed_Whitespace_bits = 0b00000000011001000000000000000000;
#if 0
static const char String_No_Passthrough[0x100] = {
/* 0x00 */ 1 /* <NUL> */, /* 0x00 */
/* 0x01 */ 1 /* <SOH> */, /* 0x01 */
@ -1577,6 +1582,7 @@ static const char Allowed_Escapes[0x100] = {
/* 0xd6 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xf5 */
/* 0xf6 */ 0,0,0,0,0,0,0,0,0, /* 0xfe */
};
#endif
static const uint32_t Allowed_Escapes_bits[0x80 / 32] = {
0b00000000000000000000000000000000,
0b00100000000000010000000000000000,
@ -1584,6 +1590,7 @@ static const uint32_t Allowed_Escapes_bits[0x80 / 32] = {
0b00100010000000100010110000000000
};
#if 0
/**
* This table contains the _values_ for a given (single) escaped character.
*/
@ -1607,6 +1614,7 @@ static unsigned char Escape_Equivs[0x100] = {
/* 0xd5 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xf4 */
/* 0xf5 */ 0,0,0,0,0,0,0,0,0,0 /* 0xfe */
};
#endif
/* Definitions of above-declared static functions */
static char get_escape_equiv(unsigned c) {

View File

@ -3,6 +3,8 @@ idf_component_register(
INCLUDE_DIRS "u8g2/src/clib"
PRIV_REQUIRES "lua" "platform"
)
# 3rd-party source is not warning clean, so suppress for now.
# Revisit when upgrading the ucg submodule.
target_compile_options(${COMPONENT_LIB} PRIVATE
-Wno-error=unused-const-variable
-Wno-unused-const-variable
)

View File

@ -2,6 +2,11 @@ idf_component_register(
SRC_DIRS "ucg/src/clib"
INCLUDE_DIRS "ucg/src/clib"
)
# 3rd-party source is not warning clean, so suppress for now.
# Revisit when upgrading the ucg submodule.
target_compile_options(${COMPONENT_LIB} PRIVATE
-Wno-error=unused-const-variable
-Wno-unused-const-variable
-Wno-unused-variable
-Wno-unused-but-set-variable
-Wno-unused-function
)

View File

@ -71,11 +71,9 @@ i2s.start(i2s_num, cfg, cb)
- `i2s.CHANNEL_ONLY_LEFT`
- `i2s.CHANNEL_ALL_RIGHT`
- `i2s.CHANNEL_ONLY_RIGHT`
- `format` communication format. Optional, defaults to `i2s.FORMAT_I2S + i2s.FORMAT_I2S_MSB` when omitted.
- `i2s.FORMAT_I2S`
- `format` communication format. Optional, defaults to `i2s.FORMAT_I2S_STANDARD` when omitted.
- `i2s.FORMAT_I2S_STANDARD`
- `i2s.FORMAT_I2S_MSB`
- `i2s.FORMAT_I2S_LSB`
- `i2s.FORMAT_PCM`
- `i2s.FORMAT_PCM_SHORT`
- `i2s.FORMAT_PCM_LONG`
- `buffer_count` number of dma buffers. Optional, defaults to 2 when omitted.