diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35874aba54c545f714a7ec1bab7d69d97363b22f..90d7e1c1bd0146bfb71e487c4b370c5480c9c040 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ image: "derq3k/card10-build-env:20190806-195837Z-f95b541-dirty" build: stage: build script: - - ./bootstrap.sh + - ./bootstrap.sh --werror - ninja -C build/ - arm-none-eabi-size build/bootloader/bootloader.elf build/epicardium/epicardium.elf build/pycardium/pycardium.elf only: @@ -14,7 +14,7 @@ build: release: stage: build script: - - ./bootstrap.sh + - ./bootstrap.sh --werror - ninja -C build/ - arm-none-eabi-size build/bootloader/bootloader.elf build/epicardium/epicardium.elf build/pycardium/pycardium.elf only: diff --git a/bootloader/crc_patch.py b/bootloader/crc_patch.py index 7d93353d507531c097a3e69d2186c15c1b8ebded..75fe55632ac8b25702814761eb06b8ec5cfea9ca 100755 --- a/bootloader/crc_patch.py +++ b/bootloader/crc_patch.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 import sys +import warnings + +warnings.simplefilter("ignore") try: import crc16 diff --git a/epicardium/api/caller.c b/epicardium/api/caller.c index f2f5643abb62e6497c19e7e831ccd1ad1a60525f..8e61b674b4179832223f1c85adafca137c2ea113 100644 --- a/epicardium/api/caller.c +++ b/epicardium/api/caller.c @@ -109,7 +109,7 @@ int api_fetch_args(char *buf, size_t cnt) return 0; } - int i; + size_t i; for (i = 0; i < cnt && API_CALL_MEM->buffer[i + 0x20] != '\0'; i++) { buf[i] = API_CALL_MEM->buffer[i + 0x20]; } diff --git a/epicardium/api/dispatcher.c b/epicardium/api/dispatcher.c index 4ffac4220a9aa0ed473a5e7cf911cb092a7135d0..20d873f2c2f6458f79991660594d9eae8001e461 100644 --- a/epicardium/api/dispatcher.c +++ b/epicardium/api/dispatcher.c @@ -86,7 +86,7 @@ void api_prepare_args(char *args) * collide with any integer return value of API calls like epic_exec(). */ API_CALL_MEM->id = 0; - for (int i = 0; i <= strlen(args); i++) { + for (size_t i = 0; i <= strlen(args); i++) { API_CALL_MEM->buffer[i + 0x20] = args[i]; } } diff --git a/epicardium/api/interrupt-sender.c b/epicardium/api/interrupt-sender.c index d531846d89fcdfaf634d1d0fa355d057a9125db3..5117bea201e2e866e606e42cb8639ed48c162513 100644 --- a/epicardium/api/interrupt-sender.c +++ b/epicardium/api/interrupt-sender.c @@ -11,7 +11,7 @@ int api_interrupt_trigger(api_int_id_t id) } if (int_enabled[id]) { - while (API_CALL_MEM->int_id != (-1)) + while (API_CALL_MEM->int_id != (api_int_id_t)(-1)) ; API_CALL_MEM->int_id = id; diff --git a/epicardium/ble/ble_main.c b/epicardium/ble/ble_main.c index 07783d8619cc05c688db056ec0d17d06b72413dc..3fec7ce48c3afb1197a62a7fbb0a1a63711926aa 100644 --- a/epicardium/ble/ble_main.c +++ b/epicardium/ble/ble_main.c @@ -122,6 +122,11 @@ static const smpCfg_t bleSmpCfg = 16, /*! Maximum encryption key length */ 3, /*! Attempts to trigger 'repeated attempts' timeout */ DM_AUTH_MITM_FLAG, /*! Device authentication requirements */ + + /* TODO: The following three parameters should probably get proper values */ + 0, /*! Maximum 'Repeated attempts' timeout in msec */ + 0, /*! Time msec before attemptExp decreases */ + 0, /*! Exponent to raise attemptTimeout on maxAttempts */ }; /* Configuration structure */ diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h index 3c9045cdf4c44d7298802a746d84addb559e5729..05d56582fcde96efc45894a218aaeaf50083062e 100644 --- a/epicardium/epicardium.h +++ b/epicardium/epicardium.h @@ -320,7 +320,7 @@ API(API_THERMISTOR_VOLTAGE, int epic_read_thermistor_voltage(float *result)); * :param length: Amount of bytes to print. */ API(API_UART_WRITE_STR, void epic_uart_write_str( - const char *str, intptr_t length + const char *str, size_t length )); /** diff --git a/epicardium/l0der/l0der.c b/epicardium/l0der/l0der.c index deb55571e3b96fe72c89d96dcc555424035116ef..5f10c441e29919e02492f31507b8509507d4430d 100644 --- a/epicardium/l0der/l0der.c +++ b/epicardium/l0der/l0der.c @@ -119,7 +119,7 @@ static int _seek_and_read(int fd, uint32_t address, void *data, size_t count) return res; } - if ((res = epic_file_read(fd, data, count)) != count) { + if ((size_t)(res = epic_file_read(fd, data, count)) != count) { LOG_ERR("l0der", "_seek_and_read: could not read: %d", res); return res; } @@ -149,7 +149,7 @@ static int _read_section_header(int fd, uint32_t shdr_addr, Elf32_Shdr *shdr) * This function ensures basic memory sanity of a program header / segment. * It ensures that it points to a file region that is contained within the file fully. */ -static int _check_program_header(int fd, int size, Elf32_Phdr *phdr) +static int _check_program_header(int fd, size_t size, Elf32_Phdr *phdr) { // Check file size/offset. uint32_t file_start = phdr->p_offset; @@ -191,7 +191,7 @@ static int _check_program_header(int fd, int size, Elf32_Phdr *phdr) * This function ensures basic memory sanity of a section header. * It ensures that it points to a file region that is contained within the file fully. */ -static int _check_section_header(int fd, int size, Elf32_Shdr *shdr) +static int _check_section_header(int fd, size_t size, Elf32_Shdr *shdr) { // Check file size/offset. uint32_t file_start = shdr->sh_offset; @@ -329,7 +329,7 @@ static int _load_segment(int fd, struct _pie_load_info *li, Elf32_Phdr *phdr) * Parse dynamic symbol sections. */ static int _parse_dynamic_symbols( - int fd, int size, struct _pie_load_info *li, Elf32_Ehdr *hdr + int fd, size_t size, struct _pie_load_info *li, Elf32_Ehdr *hdr ) { int res; Elf32_Shdr shdr; @@ -366,7 +366,7 @@ static int _parse_dynamic_symbols( return res; } - for (int j = 0; j < sym_count; j++) { + for (uint32_t j = 0; j < sym_count; j++) { if ((res = epic_file_read( fd, &sym, sizeof(Elf32_Sym))) != sizeof(Elf32_Sym)) { @@ -402,9 +402,9 @@ static int _parse_dynamic_symbols( * the only one used when making 'standard' PIE binaries on RAM. However, other * kinds might have to be implemented in the future. */ -static int -_run_relocations(int fd, int size, struct _pie_load_info *li, Elf32_Ehdr *hdr) -{ +static int _run_relocations( + int fd, size_t size, struct _pie_load_info *li, Elf32_Ehdr *hdr +) { int res; Elf32_Shdr shdr; Elf32_Rel rel; @@ -447,7 +447,7 @@ _run_relocations(int fd, int size, struct _pie_load_info *li, Elf32_Ehdr *hdr) return res; } - for (int j = 0; j < reloc_count; j++) { + for (uint32_t j = 0; j < reloc_count; j++) { if ((res = epic_file_read( fd, &rel, sizeof(Elf32_Rel))) != sizeof(Elf32_Rel)) { @@ -464,7 +464,7 @@ _run_relocations(int fd, int size, struct _pie_load_info *li, Elf32_Ehdr *hdr) // (ie., do not resolve relocation - they default to a safe NULL) uint8_t skip = 0; if (sym != 0) { - for (int k = 0; k < li->weak_symbol_count; + for (uint32_t k = 0; k < li->weak_symbol_count; k++) { if (li->weak_symbols[k] == sym) { skip = 1; @@ -513,7 +513,7 @@ _run_relocations(int fd, int size, struct _pie_load_info *li, Elf32_Ehdr *hdr) * Load a l0dable PIE binary. */ static int -_load_pie(int fd, int size, Elf32_Ehdr *hdr, struct l0dable_info *info) +_load_pie(int fd, size_t size, Elf32_Ehdr *hdr, struct l0dable_info *info) { int res; struct _pie_load_info li = { 0 }; @@ -647,7 +647,10 @@ int l0der_load_path(const char *path, struct l0dable_info *info) return res; } - int size = epic_file_tell(fd); + if ((res = epic_file_tell(fd)) < 0) { + return res; + } + size_t size = res; if ((res = epic_file_seek(fd, 0, SEEK_SET)) != 0) { return res; diff --git a/epicardium/modules/bhi.c b/epicardium/modules/bhi.c index b04d2fd5c50ad62ec0294f366958f2af932cb0a8..4e38306e4e6616f36b48f1ad6f411ad3d3377cff 100644 --- a/epicardium/modules/bhi.c +++ b/epicardium/modules/bhi.c @@ -227,7 +227,7 @@ out_free_i2c: void epic_bhi160_disable_all_sensors() { - for (int i = 0; i < sizeof(bhi160_sensor_active); i++) { + for (size_t i = 0; i < sizeof(bhi160_sensor_active); i++) { if (bhi160_sensor_active[i]) { epic_bhi160_disable_sensor(i); } diff --git a/epicardium/modules/config.c b/epicardium/modules/config.c index 6bd22d22bc8212e2db15d5bdc568446c9794029e..9f3e75f43a2fc08cb30e8a556633bf94c94f5488 100644 --- a/epicardium/modules/config.c +++ b/epicardium/modules/config.c @@ -14,7 +14,7 @@ #define MAX_LINE_LENGTH 80 #define KEYS_PER_BLOCK 16 #define KEY_LENGTH 16 -#define NOT_INT_MAGIC 0x80000000 +#define NOT_INT_MAGIC ((int)0x80000000) // one key-value pair representing a line in the config typedef struct { diff --git a/epicardium/modules/hardware.c b/epicardium/modules/hardware.c index 800cb9c65d0334939a319f66af82af895512dd01..afc44f64b7e241b0603b8239fd0aa5b8cdd0c2ff 100644 --- a/epicardium/modules/hardware.c +++ b/epicardium/modules/hardware.c @@ -95,7 +95,7 @@ int hardware_early_init(void) ; /* If we don't have a valid time yet, set it to 2019-01-01 */ - if (RTC_GetSecond() < 1546300800UL) { + if (RTC_GetSecond() < 1546300800L) { epic_rtc_set_milliseconds(1546300800UL * 1000); } diff --git a/epicardium/modules/max30001.c b/epicardium/modules/max30001.c index e3ad57da09bbcea572a336a7b5bb0a7ce343908a..fd78a77bd14d578ef125a847c781d84684047f09 100644 --- a/epicardium/modules/max30001.c +++ b/epicardium/modules/max30001.c @@ -310,11 +310,11 @@ static int max30001_fetch_fifo(void) uint32_t ecgFIFO, readECGSamples, ETAG[32], status; int16_t ecgSample[32]; - const int EINT_STATUS_MASK = 1 << 23; - const int FIFO_OVF_MASK = 0x7; - const int FIFO_VALID_SAMPLE_MASK = 0x0; - const int FIFO_FAST_SAMPLE_MASK = 0x1; - const int ETAG_BITS_MASK = 0x7; + const uint32_t EINT_STATUS_MASK = 1 << 23; + const uint32_t FIFO_OVF_MASK = 0x7; + const uint32_t FIFO_VALID_SAMPLE_MASK = 0x0; + const uint32_t FIFO_FAST_SAMPLE_MASK = 0x1; + const uint32_t ETAG_BITS_MASK = 0x7; status = ecg_read_reg(STATUS); // Read the STATUS register diff --git a/epicardium/modules/personal_state.c b/epicardium/modules/personal_state.c index cd6c52c7471af09a37560ef4b94644fc0549179c..e1990f2b8d80fee987676af3b937e35d0faca51f 100644 --- a/epicardium/modules/personal_state.c +++ b/epicardium/modules/personal_state.c @@ -18,7 +18,7 @@ int personal_state_enabled() int epic_personal_state_set(uint8_t state, bool persistent) { - if (state < STATE_NONE || state > STATE_CAMP) + if (state > STATE_CAMP) return -EINVAL; led_animation_state = 0; diff --git a/epicardium/modules/serial.c b/epicardium/modules/serial.c index ef5b65edda24b9ce828afcec18cb84f2ff7f27ef..25dd91846c9ea60a2aa26faa67cfce357ada7e9c 100644 --- a/epicardium/modules/serial.c +++ b/epicardium/modules/serial.c @@ -54,7 +54,7 @@ void serial_return_to_synchronous() /* * API-call to write a string. Output goes to both CDCACM and UART */ -void epic_uart_write_str(const char *str, intptr_t length) +void epic_uart_write_str(const char *str, size_t length) { if (length == 0) { return; @@ -161,7 +161,7 @@ static void serial_flush_from_isr(void) taskEXIT_CRITICAL_FROM_ISR(basepri); - portYIELD_FROM_ISR(&resched); + portYIELD_FROM_ISR(resched); } static void serial_flush_from_thread(void) diff --git a/epicardium/modules/sleep.c b/epicardium/modules/sleep.c index a87bcb0ce47cc601c96b67c247a32b933cb09393..70cc35c5528a8403f0858d540ddea195e6893b33 100644 --- a/epicardium/modules/sleep.c +++ b/epicardium/modules/sleep.c @@ -142,8 +142,7 @@ static void gpio_low_power(void) const unsigned int num_pins = (sizeof(pins_low_power) / sizeof(gpio_cfg_t)); - int i; - for (i = 0; i < num_pins; i++) { + for (size_t i = 0; i < num_pins; i++) { GPIO_OutClr(&pins_low_power[i]); GPIO_Config(&pins_low_power[i]); } diff --git a/hw-tests/ecgtest/main.c b/hw-tests/ecgtest/main.c index 2ca6cbdd84f9f3279af06eebccbc282b37f41fe9..f572ce73493280b45b92d8cc8923d5ffa2b9c6d4 100644 --- a/hw-tests/ecgtest/main.c +++ b/hw-tests/ecgtest/main.c @@ -401,11 +401,11 @@ int main(void) uint32_t ecgFIFO, readECGSamples, idx, ETAG[32], status; int16_t ecgSample[32]; - const int EINT_STATUS_MASK = 1 << 23; - const int FIFO_OVF_MASK = 0x7; - const int FIFO_VALID_SAMPLE_MASK = 0x0; - const int FIFO_FAST_SAMPLE_MASK = 0x1; - const int ETAG_BITS_MASK = 0x7; + const uint32_t EINT_STATUS_MASK = 1 << 23; + const uint32_t FIFO_OVF_MASK = 0x7; + const uint32_t FIFO_VALID_SAMPLE_MASK = 0x0; + const uint32_t FIFO_FAST_SAMPLE_MASK = 0x1; + const uint32_t ETAG_BITS_MASK = 0x7; while (1) { #if 1 diff --git a/lib/card10/card10.c b/lib/card10/card10.c index 43361ef06fbf76323516b68e5fdead7f7b9febd9..51ac0429390159c97bd787bc1b59fd3654ad7c8d 100644 --- a/lib/card10/card10.c +++ b/lib/card10/card10.c @@ -69,7 +69,7 @@ void card10_init(void) ) ; /* If we don't have a valid time yet, set it to 2019-01-01 */ - if (RTC_GetSecond() < 1546300800UL) { + if (RTC_GetSecond() < 1546300800L) { while (RTC_Init(MXC_RTC, 1546300800UL, 0, NULL) == E_BUSY) ; } diff --git a/lib/card10/portexpander.c b/lib/card10/portexpander.c index 8d4c3891244a8f80b9fe24ab74682c2ccfdd43c0..c1a025e299777e298c4fae47025ccfad11ae51d9 100644 --- a/lib/card10/portexpander.c +++ b/lib/card10/portexpander.c @@ -100,7 +100,7 @@ int portexpander_init(void) // Enable pull-ups for buttons // Enable outputs for the transistors, the LED and the LCD reset - for (int i = 0; i < sizeof(pe_pin_config) / sizeof(pe_pin_config[0]); + for (size_t i = 0; i < sizeof(pe_pin_config) / sizeof(pe_pin_config[0]); i++) { ret = portexpander_config(&pe_pin_config[i]); MXC_ASSERT(ret == E_NO_ERROR); diff --git a/lib/ff13/meson.build b/lib/ff13/meson.build index 6336bf286498c0b4e89c720cc2e0e8a78beb0fe6..fe2b3dc8beeca963e991af54770917eece0945e1 100644 --- a/lib/ff13/meson.build +++ b/lib/ff13/meson.build @@ -16,6 +16,7 @@ lib = static_library( sources, include_directories: includes, dependencies: [periphdriver, mx25lba], + c_args: '-w', ) libff13 = declare_dependency( diff --git a/lib/gfx/framebuffer.c b/lib/gfx/framebuffer.c index 672e956a3467999a9d8c232acb3510f4711786cb..6c8dc3aac453214494b1758a6771a0ff3959ee8f 100644 --- a/lib/gfx/framebuffer.c +++ b/lib/gfx/framebuffer.c @@ -2,8 +2,8 @@ void fb_clear_to_color(struct framebuffer *fb, Color c) { - for (int y = 0; y < fb->height; y++) { - for (int x = 0; x < fb->width; x++) + for (size_t y = 0; y < fb->height; y++) { + for (size_t x = 0; x < fb->width; x++) fb_setpixel(fb, x, y, c); } } @@ -77,7 +77,7 @@ void *fb_pixel(struct framebuffer *fb, int x, int y) if (xo < 0 || yo < 0) return NULL; - if (xo >= fb->width || yo >= fb->height) + if (xo >= (int)fb->width || yo >= (int)fb->height) return NULL; const size_t bpp = fb_bytes_per_pixel(fb); diff --git a/lib/gfx/gfx.c b/lib/gfx/gfx.c index c076a8343e39b8fef7d2f29beb825f06ba17d007..886ecdeeb99b6054ca718d05342438ade33eb25e 100644 --- a/lib/gfx/gfx.c +++ b/lib/gfx/gfx.c @@ -17,7 +17,7 @@ void gfx_setpixel(struct gfx_region *r, int x, int y, Color c) { if (x < 0 || y < 0) return; - if (x >= r->width || y >= r->height) + if ((size_t)x >= r->width || (size_t)y >= r->height) return; fb_setpixel(r->fb, r->x + x, r->y + y, c); @@ -90,7 +90,7 @@ void gfx_puts( while (*str) { // if the current position plus the width of the next character // would bring us outside of the display ... - if ((x + font->Width) > r->width) { + if ((x + font->Width) > (int)r->width) { // ... we move down a line before printing the character x = 0; y += font->Height; @@ -350,7 +350,7 @@ static void gfx_copy_region_rle_mono( Color white = gfx_color(reg, WHITE); Color black = gfx_color(reg, BLACK); - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { Color color = (data[i] & 0x80) ? white : black; uint8_t length = data[i] & 0x7f; diff --git a/lib/gfx/textbuffer.c b/lib/gfx/textbuffer.c index c52e68292a93efa87827c1a523a3d2d2cff73273..6034f2357f3c891befee082ccebdfcf82100b4ff 100644 --- a/lib/gfx/textbuffer.c +++ b/lib/gfx/textbuffer.c @@ -41,7 +41,7 @@ static void scrollup(struct txt_buffer *tm) for (int row = 0; row < last_row; row++) memcpy(&tm->text[row][0], &tm->text[row + 1][0], line_size); - for (int col = 0; col < width_(tm); col++) { + for (size_t col = 0; col < width_(tm); col++) { struct txt_glyph *g = &tm->text[last_row][col]; g->ch = ' '; g->fg_color = tm->fg_color; @@ -63,7 +63,7 @@ static inline void advance_cursor(struct txt_buffer *tm) const int last_row = height_(tm) - 1; tm->cursor_column++; - if (tm->cursor_column >= width_(tm)) { + if (tm->cursor_column >= (int)width_(tm)) { tm->cursor_column = 0; tm->cursor_row++; if (tm->cursor_row > last_row) @@ -226,9 +226,9 @@ void txt_set_cursor(struct txt_buffer *tm, int x, int y, int draw_cursor) { tm->draw_cursor = draw_cursor; - if (x < 0 || x >= width_(tm)) + if (x < 0 || x >= (int)width_(tm)) return; - if (y < 0 || y >= height_(tm)) + if (y < 0 || y >= (int)height_(tm)) return; tm->cursor_column = x; diff --git a/lib/micropython/meson.build b/lib/micropython/meson.build index dbd9c8fdbbb09316a37f2905fa83381af6f52421..4777aa4e851114cb786e29a2b1ecaa082232d199 100644 --- a/lib/micropython/meson.build +++ b/lib/micropython/meson.build @@ -31,7 +31,7 @@ mpy_cross_wrapper = executable( 'mpy-cross-wrapper.c', link_depends: mpy_cross_bin, native: true, - c_args: ['-DMPY_CROSS_PATH="' + meson.current_build_dir() + '"'], + c_args: ['-DMPY_CROSS_PATH="' + meson.current_build_dir() + '"', '-Wno-unused-parameter'], ) mpy_cross = generator( diff --git a/lib/sdk/Libraries/Boards/card10/Source/board.c b/lib/sdk/Libraries/Boards/card10/Source/board.c index e1407f08c14c2424537501e7e0f4ff32b80054a6..0739721bc2eec48bb2cf70d423ec6cfcc8bab370 100644 --- a/lib/sdk/Libraries/Boards/card10/Source/board.c +++ b/lib/sdk/Libraries/Boards/card10/Source/board.c @@ -98,7 +98,7 @@ int Board_Init(void) {PORT_0, PIN_31, GPIO_FUNC_OUT, GPIO_PAD_NONE}, // ECG switch }; const unsigned int num_pins = (sizeof(pins) / sizeof(gpio_cfg_t)); - int i; + unsigned int i; for (i = 0; i < num_pins; i++) { GPIO_OutClr(&pins[i]); GPIO_Config(&pins[i]); diff --git a/meson.build b/meson.build index f1586ec93aa9aae174a8a26bc95d1cc708e0cea5..8a0ae60bda2324f27f2cf51b185a73777537017f 100644 --- a/meson.build +++ b/meson.build @@ -7,6 +7,7 @@ project( 'c_std=c99', 'b_staticpic=false', 'b_asneeded=false', + 'warning_level=2', ], ) @@ -17,6 +18,8 @@ assert( ) add_global_arguments( + '-Wno-unused-parameter', + '-Wno-old-style-declaration', meson.get_cross_property('target_defs'), language: 'c', ) diff --git a/pycardium/meson.build b/pycardium/meson.build index e50b61dfdd69bcc7c104c94123329881e59dae2f..aa637280ad625f1b482f654f5c4f293fcfe33668 100644 --- a/pycardium/meson.build +++ b/pycardium/meson.build @@ -80,6 +80,7 @@ upy = static_library( micropython_extmod_sources, mp_headers, include_directories: micropython_includes, + c_args: '-w', ) elf = executable( diff --git a/pycardium/modules/os.c b/pycardium/modules/os.c index cc4b067996e5c505cfa0a71f3ae9e478fc99ddfb..d8e6a105f0061e75afd0fae7bce2a8aa8d9e5b79 100644 --- a/pycardium/modules/os.c +++ b/pycardium/modules/os.c @@ -29,7 +29,7 @@ bool pycrd_filename_restricted(const char *path) } fname = path; - for (int i = 0; + for (size_t i = 0; i < sizeof(forbidden_files) / sizeof(forbidden_files[0]); i++) { if (strcasecmp(fname, forbidden_files[i]) == 0) { diff --git a/pycardium/modules/sys_display.c b/pycardium/modules/sys_display.c index 387101a1594efeb7ee63e7373c6666b2b6a5a896..40ec6125bfef12132ab9cbe3ce6273b807131d37 100644 --- a/pycardium/modules/sys_display.c +++ b/pycardium/modules/sys_display.c @@ -120,7 +120,7 @@ static mp_obj_t mp_display_line(size_t n_args, const mp_obj_t *args) uint16_t ls = mp_obj_get_int(args[5]); uint16_t ps = mp_obj_get_int(args[6]); - if (ls > 1 || ls < 0) { + if (ls > 1) { mp_raise_ValueError("Line style has to be 0 or 1"); } @@ -145,7 +145,7 @@ static mp_obj_t mp_display_rect(size_t n_args, const mp_obj_t *args) uint16_t fs = mp_obj_get_int(args[5]); uint16_t ps = mp_obj_get_int(args[6]); - if (fs > 1 || fs < 0) { + if (fs > 1) { mp_raise_ValueError("Fill style has to be 0 or 1"); } @@ -169,7 +169,7 @@ static mp_obj_t mp_display_circ(size_t n_args, const mp_obj_t *args) uint16_t fs = mp_obj_get_int(args[4]); uint16_t ps = mp_obj_get_int(args[5]); - if (fs > 1 || fs < 0) { + if (fs > 1) { mp_raise_ValueError("Fill style has to be 0 or 1"); }