Explorar o código

library update

Oliver Fabel hai 1 ano
pai
achega
a1deabba8b
Modificáronse 3 ficheiros con 13 adicións e 16 borrados
  1. 7 7
      mp_flipper_logging.c
  2. 6 6
      mp_flipper_logging.h
  3. 0 3
      mp_flipper_runtime.c

+ 7 - 7
mp_flipper_logging.c

@@ -7,7 +7,7 @@
 
 #include "mp_flipper_logging.h"
 
-static const struct _mp_obj_int_t mp_flipper_log_level_obj = {.base = {&mp_type_int}, .val = MP_FLIPPER_LOG_LEVEL_INFO};
+static const struct _mp_obj_int_t mp_flipper_log_level_obj = {&mp_type_int, MP_FLIPPER_LOG_LEVEL_INFO};
 
 static mp_obj_t mp_flipper_logging_log_internal(uint8_t level, size_t n_args, const mp_obj_t* args) {
     if(n_args < 1 || level > mp_flipper_log_get_effective_level()) {
@@ -76,12 +76,12 @@ static mp_obj_t mp_flipper_logging_error(size_t n_args, const mp_obj_t* args) {
 }
 static MP_DEFINE_CONST_FUN_OBJ_VAR(mp_flipper_logging_error_obj, 1, mp_flipper_logging_error);
 
-static const struct _mp_obj_int_t mp_flipper_log_level_trace_obj = {.base = {&mp_type_int}, .val = MP_FLIPPER_LOG_LEVEL_TRACE};
-static const struct _mp_obj_int_t mp_flipper_log_level_deubg_obj = {.base = {&mp_type_int}, .val = MP_FLIPPER_LOG_LEVEL_DEBUG};
-static const struct _mp_obj_int_t mp_flipper_log_level_info_obj = {.base = {&mp_type_int}, .val = MP_FLIPPER_LOG_LEVEL_INFO};
-static const struct _mp_obj_int_t mp_flipper_log_level_warn_obj = {.base = {&mp_type_int}, .val = MP_FLIPPER_LOG_LEVEL_WARN};
-static const struct _mp_obj_int_t mp_flipper_log_level_error_obj = {.base = {&mp_type_int}, .val = MP_FLIPPER_LOG_LEVEL_ERROR};
-static const struct _mp_obj_int_t mp_flipper_log_level_none_obj = {.base = {&mp_type_int}, .val = MP_FLIPPER_LOG_LEVEL_NONE};
+static const struct _mp_obj_int_t mp_flipper_log_level_trace_obj = {&mp_type_int, MP_FLIPPER_LOG_LEVEL_TRACE};
+static const struct _mp_obj_int_t mp_flipper_log_level_deubg_obj = {&mp_type_int, MP_FLIPPER_LOG_LEVEL_DEBUG};
+static const struct _mp_obj_int_t mp_flipper_log_level_info_obj = {&mp_type_int, MP_FLIPPER_LOG_LEVEL_INFO};
+static const struct _mp_obj_int_t mp_flipper_log_level_warn_obj = {&mp_type_int, MP_FLIPPER_LOG_LEVEL_WARN};
+static const struct _mp_obj_int_t mp_flipper_log_level_error_obj = {&mp_type_int, MP_FLIPPER_LOG_LEVEL_ERROR};
+static const struct _mp_obj_int_t mp_flipper_log_level_none_obj = {&mp_type_int, MP_FLIPPER_LOG_LEVEL_NONE};
 
 static const mp_rom_map_elem_t mp_module_logging_globals_table[] = {
     {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_logging)},

+ 6 - 6
mp_flipper_logging.h

@@ -3,12 +3,12 @@
 #include <stdint.h>
 #include <stdbool.h>
 
-extern const uint8_t MP_FLIPPER_LOG_LEVEL_TRACE;
-extern const uint8_t MP_FLIPPER_LOG_LEVEL_DEBUG;
-extern const uint8_t MP_FLIPPER_LOG_LEVEL_INFO;
-extern const uint8_t MP_FLIPPER_LOG_LEVEL_WARN;
-extern const uint8_t MP_FLIPPER_LOG_LEVEL_ERROR;
-extern const uint8_t MP_FLIPPER_LOG_LEVEL_NONE;
+#define MP_FLIPPER_LOG_LEVEL_TRACE (6)
+#define MP_FLIPPER_LOG_LEVEL_DEBUG (5)
+#define MP_FLIPPER_LOG_LEVEL_INFO (4)
+#define MP_FLIPPER_LOG_LEVEL_WARN (3)
+#define MP_FLIPPER_LOG_LEVEL_ERROR (2)
+#define MP_FLIPPER_LOG_LEVEL_NONE (1)
 
 uint8_t mp_flipper_log_get_effective_level();
 bool mp_flipper_log_level_is_valid(uint8_t level);

+ 0 - 3
mp_flipper_runtime.c

@@ -9,7 +9,6 @@
 
 #include "mp_flipper_runtime.h"
 #include "mp_flipper_halport.h"
-#include "mp_flipper_logging.h"
 
 const char* mp_flipper_root_module_path;
 
@@ -22,8 +21,6 @@ void mp_flipper_set_root_module_path(const char* path) {
 void mp_flipper_init(void* heap, size_t heap_size, size_t stack_size, void* stack_top) {
     mp_flipper_context = mp_flipper_context_alloc();
 
-    mp_flipper_log_level = MP_FLIPPER_LOG_LEVEL_INFO;
-
     mp_stack_set_top(stack_top);
     mp_stack_set_limit(stack_size);