New panel design
This commit is contained in:
1 parent
face2432e4
commit
b5d6b4a897
30 files changed
+4540
-171
No files matched your search
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Host stand-in for ESP-IDF's esp_check.h -- see compat/esp_err.h.
|
||||
*/
|
||||
#ifndef ESP_CHECK_H
|
||||
#define ESP_CHECK_H
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#define ESP_RETURN_ON_ERROR(x, tag, fmt, ...) \
|
||||
do { \
|
||||
const esp_err_t err_rc_ = (x); \
|
||||
if (err_rc_ != ESP_OK) { \
|
||||
ESP_LOGE(tag, fmt, ##__VA_ARGS__); \
|
||||
return err_rc_; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ESP_RETURN_ON_FALSE(a, err_code, tag, fmt, ...) \
|
||||
do { \
|
||||
if (!(a)) { \
|
||||
ESP_LOGE(tag, fmt, ##__VA_ARGS__); \
|
||||
return (err_code); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ESP_GOTO_ON_ERROR(x, goto_tag, tag, fmt, ...) \
|
||||
do { \
|
||||
const esp_err_t err_rc_ = (x); \
|
||||
if (err_rc_ != ESP_OK) { \
|
||||
ret = err_rc_; \
|
||||
ESP_LOGE(tag, fmt, ##__VA_ARGS__); \
|
||||
goto goto_tag; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ESP_GOTO_ON_FALSE(a, err_code, goto_tag, tag, fmt, ...) \
|
||||
do { \
|
||||
if (!(a)) { \
|
||||
ret = (err_code); \
|
||||
ESP_LOGE(tag, fmt, ##__VA_ARGS__); \
|
||||
goto goto_tag; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
const char *esp_err_to_name(esp_err_t code)
|
||||
{
|
||||
switch (code) {
|
||||
case ESP_OK: return "ESP_OK";
|
||||
case ESP_FAIL: return "ESP_FAIL";
|
||||
case ESP_ERR_NO_MEM: return "ESP_ERR_NO_MEM";
|
||||
case ESP_ERR_INVALID_ARG: return "ESP_ERR_INVALID_ARG";
|
||||
case ESP_ERR_INVALID_STATE: return "ESP_ERR_INVALID_STATE";
|
||||
case ESP_ERR_INVALID_SIZE: return "ESP_ERR_INVALID_SIZE";
|
||||
case ESP_ERR_NOT_FOUND: return "ESP_ERR_NOT_FOUND";
|
||||
case ESP_ERR_NOT_SUPPORTED: return "ESP_ERR_NOT_SUPPORTED";
|
||||
case ESP_ERR_TIMEOUT: return "ESP_ERR_TIMEOUT";
|
||||
case ESP_ERR_INVALID_RESPONSE: return "ESP_ERR_INVALID_RESPONSE";
|
||||
default: return "ESP_ERR_UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
void esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *expr)
|
||||
{
|
||||
fprintf(stderr, "ESP_ERROR_CHECK failed: %s (0x%x) at %s:%d\n expression: %s\n",
|
||||
esp_err_to_name(rc), rc, file, line, expr);
|
||||
abort();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Host stand-in for ESP-IDF's esp_err.h.
|
||||
*
|
||||
* The simulator compiles the real firmware UI sources unmodified. Those
|
||||
* sources include ESP-IDF headers, so the simulator supplies its own versions
|
||||
* on the include path rather than sprinkling #ifdefs through main/. Only the
|
||||
* surface the shared sources actually use is defined here -- if a new firmware
|
||||
* source is added to the simulator build and fails to compile, extend this
|
||||
* file, do not fork the firmware source.
|
||||
*/
|
||||
#ifndef ESP_ERR_H
|
||||
#define ESP_ERR_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int esp_err_t;
|
||||
|
||||
#define ESP_OK 0
|
||||
#define ESP_FAIL -1
|
||||
|
||||
#define ESP_ERR_NO_MEM 0x101
|
||||
#define ESP_ERR_INVALID_ARG 0x102
|
||||
#define ESP_ERR_INVALID_STATE 0x103
|
||||
#define ESP_ERR_INVALID_SIZE 0x104
|
||||
#define ESP_ERR_NOT_FOUND 0x105
|
||||
#define ESP_ERR_NOT_SUPPORTED 0x106
|
||||
#define ESP_ERR_TIMEOUT 0x107
|
||||
#define ESP_ERR_INVALID_RESPONSE 0x108
|
||||
|
||||
const char *esp_err_to_name(esp_err_t code);
|
||||
|
||||
/* Aborts on the host too -- a failed ESP_ERROR_CHECK is a bug worth crashing
|
||||
* on in the simulator exactly as it is on the device. */
|
||||
void esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *expr);
|
||||
|
||||
#define ESP_ERROR_CHECK(x) \
|
||||
do { \
|
||||
const esp_err_t err_rc_ = (x); \
|
||||
if (err_rc_ != ESP_OK) { \
|
||||
esp_error_check_failed(err_rc_, __FILE__, __LINE__, #x); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Host stand-in for ESP-IDF's esp_log.h -- see compat/esp_err.h for why these
|
||||
* shims exist. Logs go to stderr so that stdout stays clean for anything the
|
||||
* simulator wants to emit as data.
|
||||
*/
|
||||
#ifndef ESP_LOG_H
|
||||
#define ESP_LOG_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* ANSI colours matched to idf.py monitor, so simulator output reads the same
|
||||
* way device output does. */
|
||||
#define ESP_LOG_COLOR_E "\033[0;31m"
|
||||
#define ESP_LOG_COLOR_W "\033[0;33m"
|
||||
#define ESP_LOG_COLOR_I "\033[0;32m"
|
||||
#define ESP_LOG_COLOR_D "\033[0;36m"
|
||||
#define ESP_LOG_RESET "\033[0m"
|
||||
|
||||
#define ESP_LOG_LEVEL_LOCAL(colour, letter, tag, fmt, ...) \
|
||||
fprintf(stderr, colour letter " (sim) %s: " fmt ESP_LOG_RESET "\n", tag, ##__VA_ARGS__)
|
||||
|
||||
#define ESP_LOGE(tag, fmt, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_COLOR_E, "E", tag, fmt, ##__VA_ARGS__)
|
||||
#define ESP_LOGW(tag, fmt, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_COLOR_W, "W", tag, fmt, ##__VA_ARGS__)
|
||||
#define ESP_LOGI(tag, fmt, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_COLOR_I, "I", tag, fmt, ##__VA_ARGS__)
|
||||
#define ESP_LOGD(tag, fmt, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_COLOR_D, "D", tag, fmt, ##__VA_ARGS__)
|
||||
#define ESP_LOGV(tag, fmt, ...) ESP_LOG_LEVEL_LOCAL(ESP_LOG_COLOR_D, "V", tag, fmt, ##__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user