mirror of
https://github.com/esphome/esphome.git
synced 2024-12-24 14:34:54 +01:00
Add lint check for integer constants (#775)
This commit is contained in:
parent
8867a0fcfb
commit
6f63a62a8d
3 changed files with 8 additions and 8 deletions
|
@ -4,11 +4,11 @@
|
||||||
#include "esphome/components/uart/uart.h"
|
#include "esphome/components/uart/uart.h"
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
|
|
||||||
#define SIM800L_READ_BUFFER_LENGTH 255
|
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace sim800l {
|
namespace sim800l {
|
||||||
|
|
||||||
|
const uint8_t SIM800L_READ_BUFFER_LENGTH = 255;
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
STATE_IDLE = 0,
|
STATE_IDLE = 0,
|
||||||
STATE_INIT,
|
STATE_INIT,
|
||||||
|
|
|
@ -54,15 +54,15 @@ bool ESPPreferenceObject::save_() {
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
|
||||||
#define ESP_RTC_USER_MEM_START 0x60001200
|
static const uint32_t ESP_RTC_USER_MEM_START = 0x60001200;
|
||||||
#define ESP_RTC_USER_MEM ((uint32_t *) ESP_RTC_USER_MEM_START)
|
#define ESP_RTC_USER_MEM ((uint32_t *) ESP_RTC_USER_MEM_START)
|
||||||
#define ESP_RTC_USER_MEM_SIZE_WORDS 128
|
static const uint32_t ESP_RTC_USER_MEM_SIZE_WORDS = 128;
|
||||||
#define ESP_RTC_USER_MEM_SIZE_BYTES ESP_RTC_USER_MEM_SIZE_WORDS * 4
|
static const uint32_t ESP_RTC_USER_MEM_SIZE_BYTES = ESP_RTC_USER_MEM_SIZE_WORDS * 4;
|
||||||
|
|
||||||
#ifdef USE_ESP8266_PREFERENCES_FLASH
|
#ifdef USE_ESP8266_PREFERENCES_FLASH
|
||||||
#define ESP8266_FLASH_STORAGE_SIZE 128
|
static const uint32_t ESP8266_FLASH_STORAGE_SIZE = 128;
|
||||||
#else
|
#else
|
||||||
#define ESP8266_FLASH_STORAGE_SIZE 64
|
static const uint32_t ESP8266_FLASH_STORAGE_SIZE = 64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline bool esp_rtc_user_mem_read(uint32_t index, uint32_t *dest) {
|
static inline bool esp_rtc_user_mem_read(uint32_t index, uint32_t *dest) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import codecs
|
||||||
import collections
|
import collections
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
@ -262,7 +263,6 @@ def lint_constants_usage():
|
||||||
errors.append("Constant {} is defined in {} files. Please move all definitions of the "
|
errors.append("Constant {} is defined in {} files. Please move all definitions of the "
|
||||||
"constant to const.py (Uses: {})"
|
"constant to const.py (Uses: {})"
|
||||||
"".format(highlight(constant), len(uses), ', '.join(uses)))
|
"".format(highlight(constant), len(uses), ', '.join(uses)))
|
||||||
return errors
|
|
||||||
|
|
||||||
|
|
||||||
def relative_cpp_search_text(fname, content):
|
def relative_cpp_search_text(fname, content):
|
||||||
|
|
Loading…
Reference in a new issue