Merge branch 'jgromes:master' into FIFO-Refill
This commit is contained in:
commit
eda1067a71
9 changed files with 57 additions and 17 deletions
24
.github/workflows/unit-test.yml
vendored
24
.github/workflows/unit-test.yml
vendored
|
@ -10,7 +10,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
unit-test:
|
unit-test:
|
||||||
name: Build and run unit test
|
name: Build and run unit test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
@ -19,9 +19,29 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libboost-all-dev libfmt-dev
|
sudo apt-get install -y libboost-all-dev libfmt-dev lcov
|
||||||
|
|
||||||
- name: Run unit test
|
- name: Run unit test
|
||||||
run: |
|
run: |
|
||||||
cd extras/test/unit
|
cd extras/test/unit
|
||||||
./test.sh
|
./test.sh
|
||||||
|
|
||||||
|
- name: Measure test coverage
|
||||||
|
run: |
|
||||||
|
cd extras/test/unit
|
||||||
|
./coverage.sh
|
||||||
|
|
||||||
|
- name: Upload coverage report as artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: coverage_report
|
||||||
|
path: extras/test/unit/lcov.report
|
||||||
|
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_branch: gh-pages
|
||||||
|
publish_dir: extras/test/unit/lcov.report
|
||||||
|
destination_dir: coverage
|
||||||
|
keep_files: true
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [[ $@ -lt 1 ]]; then
|
if [[ $# -lt 1 ]]; then
|
||||||
echo "Usage: $0 <path to check>"
|
echo "Usage: $0 <path to check>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
1
extras/test/unit/.gitignore
vendored
1
extras/test/unit/.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
build/
|
build/
|
||||||
|
lcov*
|
||||||
|
|
|
@ -18,11 +18,13 @@ add_executable(${PROJECT_NAME} ${TEST_SOURCES})
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
||||||
|
|
||||||
# link RadioLib
|
# link RadioLib
|
||||||
target_link_libraries(${PROJECT_NAME} RadioLib fmt)
|
target_link_libraries(${PROJECT_NAME} RadioLib fmt gcov)
|
||||||
|
|
||||||
# set target properties and options
|
# set target properties and options
|
||||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
|
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
|
set(BUILD_FLAGS -Wall -Wextra -fprofile-arcs -ftest-coverage -O0)
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE ${BUILD_FLAGS})
|
||||||
|
target_compile_options(RadioLib PRIVATE ${BUILD_FLAGS})
|
||||||
|
|
||||||
# set RadioLib debug
|
# set RadioLib debug
|
||||||
#target_compile_definitions(RadioLib PUBLIC RADIOLIB_DEBUG_BASIC RADIOLIB_DEBUG_SPI RADIOLIB_DEBUG_PROTOCOL)
|
#target_compile_definitions(RadioLib PUBLIC RADIOLIB_DEBUG_BASIC RADIOLIB_DEBUG_SPI RADIOLIB_DEBUG_PROTOCOL)
|
||||||
|
|
12
extras/test/unit/coverage.sh
Executable file
12
extras/test/unit/coverage.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
filename="lcov"
|
||||||
|
rm -rf $filename.*
|
||||||
|
lcov --capture --directory build --output-file "${filename}.info"
|
||||||
|
|
||||||
|
# filter out boost and C++ standard library
|
||||||
|
lcov --remove "${filename}.info" "/usr/*/boost/*" "/usr/include/c++/*" --output-file "${filename}.info"
|
||||||
|
|
||||||
|
# generate HTML
|
||||||
|
genhtml "${filename}.info" --output-directory "${filename}.report"
|
|
@ -118,6 +118,10 @@
|
||||||
//#define RADIOLIB_CLOCK_DRIFT_MS (0)
|
//#define RADIOLIB_CLOCK_DRIFT_MS (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(RADIOLIB_LINE_FEED)
|
||||||
|
#define RADIOLIB_LINE_FEED "\r\n"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ARDUINO >= 100
|
#if ARDUINO >= 100
|
||||||
// Arduino build
|
// Arduino build
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
@ -471,9 +475,9 @@
|
||||||
#if RADIOLIB_DEBUG
|
#if RADIOLIB_DEBUG
|
||||||
#if defined(RADIOLIB_BUILD_ARDUINO)
|
#if defined(RADIOLIB_BUILD_ARDUINO)
|
||||||
#define RADIOLIB_DEBUG_PRINT(...) rlb_printf(__VA_ARGS__)
|
#define RADIOLIB_DEBUG_PRINT(...) rlb_printf(__VA_ARGS__)
|
||||||
#define RADIOLIB_DEBUG_PRINTLN(M, ...) rlb_printf(M "\n", ##__VA_ARGS__)
|
#define RADIOLIB_DEBUG_PRINTLN(M, ...) rlb_printf(M "" RADIOLIB_LINE_FEED, ##__VA_ARGS__)
|
||||||
#define RADIOLIB_DEBUG_PRINT_LVL(LEVEL, M, ...) rlb_printf(LEVEL "" M, ##__VA_ARGS__)
|
#define RADIOLIB_DEBUG_PRINT_LVL(LEVEL, M, ...) rlb_printf(LEVEL "" M, ##__VA_ARGS__)
|
||||||
#define RADIOLIB_DEBUG_PRINTLN_LVL(LEVEL, M, ...) rlb_printf(LEVEL "" M "\n", ##__VA_ARGS__)
|
#define RADIOLIB_DEBUG_PRINTLN_LVL(LEVEL, M, ...) rlb_printf(LEVEL "" M "" RADIOLIB_LINE_FEED, ##__VA_ARGS__)
|
||||||
|
|
||||||
// some platforms do not support printf("%f"), so it has to be done this way
|
// some platforms do not support printf("%f"), so it has to be done this way
|
||||||
#define RADIOLIB_DEBUG_PRINT_FLOAT(LEVEL, VAL, DECIMALS) RADIOLIB_DEBUG_PRINT(LEVEL); RADIOLIB_DEBUG_PORT.print(VAL, DECIMALS)
|
#define RADIOLIB_DEBUG_PRINT_FLOAT(LEVEL, VAL, DECIMALS) RADIOLIB_DEBUG_PRINT(LEVEL); RADIOLIB_DEBUG_PORT.print(VAL, DECIMALS)
|
||||||
|
@ -483,8 +487,8 @@
|
||||||
#define RADIOLIB_DEBUG_PRINT_LVL(LEVEL, M, ...) fprintf(RADIOLIB_DEBUG_PORT, LEVEL "" M, ##__VA_ARGS__)
|
#define RADIOLIB_DEBUG_PRINT_LVL(LEVEL, M, ...) fprintf(RADIOLIB_DEBUG_PORT, LEVEL "" M, ##__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(RADIOLIB_DEBUG_PRINTLN)
|
#if !defined(RADIOLIB_DEBUG_PRINTLN)
|
||||||
#define RADIOLIB_DEBUG_PRINTLN(M, ...) fprintf(RADIOLIB_DEBUG_PORT, M "\n", ##__VA_ARGS__)
|
#define RADIOLIB_DEBUG_PRINTLN(M, ...) fprintf(RADIOLIB_DEBUG_PORT, M "" RADIOLIB_LINE_FEED, ##__VA_ARGS__)
|
||||||
#define RADIOLIB_DEBUG_PRINTLN_LVL(LEVEL, M, ...) fprintf(RADIOLIB_DEBUG_PORT, LEVEL "" M "\n", ##__VA_ARGS__)
|
#define RADIOLIB_DEBUG_PRINTLN_LVL(LEVEL, M, ...) fprintf(RADIOLIB_DEBUG_PORT, LEVEL "" M "" RADIOLIB_LINE_FEED, ##__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
#define RADIOLIB_DEBUG_PRINT_FLOAT(LEVEL, VAL, DECIMALS) RADIOLIB_DEBUG_PRINT(LEVEL "%.3f", VAL)
|
#define RADIOLIB_DEBUG_PRINT_FLOAT(LEVEL, VAL, DECIMALS) RADIOLIB_DEBUG_PRINT(LEVEL "%.3f", VAL)
|
||||||
#endif
|
#endif
|
||||||
|
@ -545,13 +549,13 @@
|
||||||
#define RADIOLIB_VALUE_TO_STRING(x) #x
|
#define RADIOLIB_VALUE_TO_STRING(x) #x
|
||||||
#define RADIOLIB_VALUE(x) RADIOLIB_VALUE_TO_STRING(x)
|
#define RADIOLIB_VALUE(x) RADIOLIB_VALUE_TO_STRING(x)
|
||||||
|
|
||||||
#define RADIOLIB_INFO "\nRadioLib Info\nVersion: \"" \
|
#define RADIOLIB_INFO "\r\nRadioLib Info\nVersion: \"" \
|
||||||
RADIOLIB_VALUE(RADIOLIB_VERSION_MAJOR) "." \
|
RADIOLIB_VALUE(RADIOLIB_VERSION_MAJOR) "." \
|
||||||
RADIOLIB_VALUE(RADIOLIB_VERSION_MINOR) "." \
|
RADIOLIB_VALUE(RADIOLIB_VERSION_MINOR) "." \
|
||||||
RADIOLIB_VALUE(RADIOLIB_VERSION_PATCH) "." \
|
RADIOLIB_VALUE(RADIOLIB_VERSION_PATCH) "." \
|
||||||
RADIOLIB_VALUE(RADIOLIB_VERSION_EXTRA) "\"\n" \
|
RADIOLIB_VALUE(RADIOLIB_VERSION_EXTRA) "\"\r\n" \
|
||||||
"Platform: " RADIOLIB_VALUE(RADIOLIB_PLATFORM) "\n" \
|
"Platform: " RADIOLIB_VALUE(RADIOLIB_PLATFORM) "\r\n" \
|
||||||
"Compiled: " RADIOLIB_VALUE(__DATE__) " " RADIOLIB_VALUE(__TIME__)
|
RADIOLIB_VALUE(__DATE__) " " RADIOLIB_VALUE(__TIME__)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief A simple assert macro, will return on error.
|
\brief A simple assert macro, will return on error.
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
- PhysicalLayer - FSK and LoRa radio modules
|
- PhysicalLayer - FSK and LoRa radio modules
|
||||||
|
|
||||||
\see https://github.com/jgromes/RadioLib
|
\see https://github.com/jgromes/RadioLib
|
||||||
|
\see https://jgromes.github.io/RadioLib/coverage/src/index.html
|
||||||
|
|
||||||
\copyright Copyright (c) 2019 Jan Gromes
|
\copyright Copyright (c) 2019 Jan Gromes
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -765,9 +765,9 @@ int16_t Si443x::updateClockRecovery() {
|
||||||
uint16_t rxOsr_fixed = (uint16_t)rxOsr;
|
uint16_t rxOsr_fixed = (uint16_t)rxOsr;
|
||||||
|
|
||||||
// print that whole mess
|
// print that whole mess
|
||||||
RADIOLIB_DEBUG_BASIC_PRINTLN("%X\n%X\n%X", bypass, decRate, manch);
|
RADIOLIB_DEBUG_BASIC_PRINTLN("%X %X %X", bypass, decRate, manch);
|
||||||
RADIOLIB_DEBUG_BASIC_PRINT_FLOAT((double)rxOsr, 2);
|
RADIOLIB_DEBUG_BASIC_PRINT_FLOAT((double)rxOsr, 2);
|
||||||
RADIOLIB_DEBUG_BASIC_PRINTLN("\t%d\t%X\n%lu\t%lX\n%d\t%X", rxOsr_fixed, rxOsr_fixed, (long unsigned int)ncoOff, (long unsigned int)ncoOff, crGain, crGain);
|
RADIOLIB_DEBUG_BASIC_PRINTLN("\t%d\t%X" RADIOLIB_LINE_FEED "%lu\t%lX" RADIOLIB_LINE_FEED "%d\t%X", rxOsr_fixed, rxOsr_fixed, (long unsigned int)ncoOff, (long unsigned int)ncoOff, crGain, crGain);
|
||||||
|
|
||||||
// update oversampling ratio
|
// update oversampling ratio
|
||||||
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_SI443X_REG_CLOCK_REC_OFFSET_2, (uint8_t)((rxOsr_fixed & 0x0700) >> 3), 7, 5);
|
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_SI443X_REG_CLOCK_REC_OFFSET_2, (uint8_t)((rxOsr_fixed & 0x0700) >> 3), 7, 5);
|
||||||
|
|
|
@ -86,7 +86,7 @@ int MorseClient::read(uint8_t* symbol, uint8_t* len, float low, float high) {
|
||||||
if((pauseLen >= low*(float)letterSpace) && (pauseLen <= high*(float)letterSpace)) {
|
if((pauseLen >= low*(float)letterSpace) && (pauseLen <= high*(float)letterSpace)) {
|
||||||
return(RADIOLIB_MORSE_CHAR_COMPLETE);
|
return(RADIOLIB_MORSE_CHAR_COMPLETE);
|
||||||
} else if(pauseLen > wordSpace) {
|
} else if(pauseLen > wordSpace) {
|
||||||
RADIOLIB_DEBUG_PROTOCOL_PRINTLN("\n<space>");
|
RADIOLIB_DEBUG_PROTOCOL_PRINTLN(RADIOLIB_LINE_FEED "<space>");
|
||||||
return(RADIOLIB_MORSE_WORD_COMPLETE);
|
return(RADIOLIB_MORSE_WORD_COMPLETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ size_t MorseClient::write(uint8_t b) {
|
||||||
// letter space
|
// letter space
|
||||||
standby();
|
standby();
|
||||||
mod->waitForMicroseconds(mod->hal->micros(), letterSpace*1000 - dotLength*1000);
|
mod->waitForMicroseconds(mod->hal->micros(), letterSpace*1000 - dotLength*1000);
|
||||||
RADIOLIB_DEBUG_PROTOCOL_PRINT_NOTAG("\n");
|
RADIOLIB_DEBUG_PROTOCOL_PRINT_NOTAG(RADIOLIB_LINE_FEED);
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue