Search found 16 matches

by RobMeades
Thu Feb 14, 2019 5:09 pm
Forum: ESP32 IDF
Topic: Unit testing: cleaning up after a test fails
Replies: 0
Views: 292

Unit testing: cleaning up after a test fails

I have a set of unit test cases building and running successfully. In general, each of my tests has to lock a resource, use that resource and then unlock the resource. My problem is that, if one of the TEST_ASSERT() checks that I'm making fails while the test is in the "using resource" portion, the ...
by RobMeades
Tue Feb 12, 2019 1:34 pm
Forum: ESP32 IDF
Topic: [Solved] Design pattern: how to cleanly exit from a task that is waiting on a UART queue
Replies: 4
Views: 793

Re: Design pattern: how to cleanly exit from a task that is waiting on a UART queue

Ah, yes, well done, that was it. I obviously need to be more au fait with Free RTOSness.
by RobMeades
Tue Feb 12, 2019 12:47 pm
Forum: ESP32 IDF
Topic: [Not a] Bugette in UART examples
Replies: 11
Views: 1332

Re: [Not a] Bugette in UART examples

Joking aside, I'm told that this would currently fail our Lint checking. But I do agree on "for (int i=": I once eschewed this practice but have since seen the light of limiting scope in this way. Maybe one day KISS (Keep It Simple Stupid) will edge forward.
by RobMeades
Tue Feb 12, 2019 12:02 pm
Forum: ESP32 IDF
Topic: [Not a] Bugette in UART examples
Replies: 11
Views: 1332

Re: [Not a] Bugette in UART examples

Newest coding standard (which I wrote) allows "//" comments but some still fear them from the days when compilers with previous ANSI compliance and strict checking would throw an error.

Next you'll be saying that the ESP32 API's should have been written in C++ like mbed-os ;-).
by RobMeades
Tue Feb 12, 2019 11:53 am
Forum: ESP32 IDF
Topic: [Not a] Bugette in UART examples
Replies: 11
Views: 1332

Re: [Not a] Bugette in UART examples

:-) I thought you might say that. Just to give you an idea how conservative the embedded world is, I've been coding embedded systems in C all my working life (which started after C90) and have never seen this construction before. And I'm not alone: I asked a colleague 10 years younger than me and he...
by RobMeades
Tue Feb 12, 2019 10:41 am
Forum: ESP32 IDF
Topic: [Not a] Bugette in UART examples
Replies: 11
Views: 1332

Re: [Not a] Bugette in UART examples

Yes, though I won't use C90-style initialisers myself just yet (afraid that people reading my code will not realise what's going on in such scarily modern constructions), I now know what you intend and so can initialise all the structure elements appropriately myself.
by RobMeades
Tue Feb 12, 2019 9:58 am
Forum: ESP32 IDF
Topic: [Solved] Beginners question: specifying multiple components in TEST_COMPONENTS
Replies: 7
Views: 1037

Re: Beginners question: specifying multiple components in TEST_COMPONENTS

Ah! Well, done, you've cracked it! If I do: MINGW32> make -C ${IDF_PATH}/tools/unit-test-app EXTRA_COMPONENT_DIRS="~/esp/test-project/components" TEST_COMPONENTS="accelerometer-lis2dw battery-charger-bq24295" ...then that builds both sets of tests. It's probably worth you updating some documentation...
by RobMeades
Tue Feb 12, 2019 9:42 am
Forum: ESP32 IDF
Topic: [Solved] Design pattern: how to cleanly exit from a task that is waiting on a UART queue
Replies: 4
Views: 793

Re: Design pattern: how to cleanly exit from a task that is waiting on a UART queue

I've included the function in question, marking the specific line, below. Git log shows that the last thing in my tree was v3.1.1, sha 3b92e85b308578c24f14f57371498303c198c7cb. esp_err_t uart_flush_input(uart_port_t uart_num) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); UART_...
by RobMeades
Mon Feb 11, 2019 1:29 pm
Forum: ESP32 IDF
Topic: [Solved] Beginners question: specifying multiple components in TEST_COMPONENTS
Replies: 7
Views: 1037

Re: Beginners question: specifying multiple components in TEST_COMPONENTS

Any thoughts on this? I would like to resolve what's going on as running separate builds for each component's unit test is quite time consuming.
by RobMeades
Mon Feb 11, 2019 11:48 am
Forum: ESP32 IDF
Topic: [Solved] Design pattern: how to cleanly exit from a task that is waiting on a UART queue
Replies: 4
Views: 793

[Solved] Design pattern: how to cleanly exit from a task that is waiting on a UART queue

I have a component which creates a dynamic task that waits on a UART queue for received characters, like so: static void rx_task(void *pvParameters) { uart_event_t uart_event; while (1) { if (xQueueReceive(_queue_uart, (void *) &uart_event, (portTickType) portMAX_DELAY)) { if (uart_event.size > 0) {...

Go to advanced search