diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 45ed5605..6bf56640 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -127,7 +127,7 @@ jobs: steps: - uses: actions/checkout@v3 with: { fetch-depth: 2 } - - run: if ./test/match_changed_files.sh "^src|examples/stm32/nucleo-f7" ; then echo GO=1 >> $GITHUB_ENV ; fi + - run: if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/stm32/nucleo-f7" ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi - if: ${{ env.GO == 1 }} @@ -142,7 +142,7 @@ jobs: steps: - uses: actions/checkout@v3 with: { fetch-depth: 2 } - - run: if ./test/match_changed_files.sh "^src|examples/stm32/nucleo-f4" ; then echo GO=1 >> $GITHUB_ENV ; fi + - run: if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/stm32/nucleo-f4" ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi - if: ${{ env.GO == 1 }} @@ -155,7 +155,7 @@ jobs: steps: - uses: actions/checkout@v3 with: { fetch-depth: 3 } - - run: if ./test/match_changed_files.sh "^src|examples/stm32/nucleo-h7" ; then echo GO=1 >> $GITHUB_ENV ; fi + - run: if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/stm32/nucleo-h7" ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi - if: ${{ env.GO == 1 }} @@ -166,7 +166,7 @@ jobs: steps: - uses: actions/checkout@v3 with: { fetch-depth: 2 } - - run: if ./test/match_changed_files.sh "^src|examples/ti/ek-tm4c" ; then echo GO=1 >> $GITHUB_ENV ; fi + - run: if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/ti/ek-tm4c" ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi - run: echo GO=0 > $GITHUB_ENV ; if ./test/match_changed_files.sh "^src|examples/ti/ek-tm4c1294xl-baremetal" ; then echo GO=1 > $GITHUB_ENV ; fi @@ -181,7 +181,7 @@ jobs: steps: - uses: actions/checkout@v3 with: { fetch-depth: 2 } - - run: if ./test/match_changed_files.sh "^src|examples/rp2040/pico-w5500" ; then echo GO=1 >> $GITHUB_ENV ; fi + - run: if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/rp2040/pico-w5500" ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi - if: ${{ env.GO == 1 }} diff --git a/examples/device-dashboard/net.c b/examples/device-dashboard/net.c index 7eb5b525..3e2314a9 100644 --- a/examples/device-dashboard/net.c +++ b/examples/device-dashboard/net.c @@ -149,8 +149,8 @@ static void handle_stats_get(struct mg_connection *c) { static size_t print_events(void (*out)(char, void *), void *ptr, va_list *ap) { size_t len = 0; - int page_number = va_arg(*ap, int); - int start = (page_number - 1) * EVENTS_PER_PAGE; + int pageno = va_arg(*ap, int); + int start = (pageno - 1) * EVENTS_PER_PAGE; int end = start + EVENTS_PER_PAGE; for (int i = start; i < end && i < events_no; i++) { @@ -166,17 +166,13 @@ static size_t print_events(void (*out)(char, void *), void *ptr, va_list *ap) { } static void handle_events_get(struct mg_connection *c, struct mg_str query) { - int page_number; - bool is_last_page; - + int pageno; // query is represented by 'page=' - page_number = atoi(query.ptr + 5); - if (page_number > events_no / EVENTS_PER_PAGE + 1 || page_number < 1) - page_number = 1; + pageno = atoi(query.ptr + 5); + if (pageno > events_no / EVENTS_PER_PAGE + 1 || pageno < 1) pageno = 1; mg_http_reply(c, 200, s_json_header, "{%m:[%M], %m:%d}", MG_ESC("arr"), - print_events, page_number, - MG_ESC("totalCount"), events_no); + print_events, pageno, MG_ESC("totalCount"), events_no); } static void handle_settings_set(struct mg_connection *c, struct mg_str body) {