Compare commits

...

4 Commits

7 changed files with 32 additions and 4 deletions

View File

@ -218,7 +218,7 @@ static void parseAndPrintFrame() {
// mbusCommHandle.requestId,
// parsedVIB.name, parsedVIB.unit, parsedVIB.exponent);
if (parsedVIB.found) {
uint32_t value = strtol(mbus_data_record_value(record), NULL, 10);
int32_t value = strtol(mbus_data_record_value(record), NULL, 10);
float weightedValue = ((float) value) * powf(10.0, ((float) parsedVIB.exponent));
coloredMsg(LOG_YELLOW, false, "mbc papf [%d] %s is %.1f %s (%d * 10^%d)",
mbusCommHandle.requestId, parsedVIB.name, weightedValue, parsedVIB.unit,

BIN
docs/IMG_2915.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

@ -1,3 +1,6 @@
![](./docs/IMG_2915.jpg)
## Build environment
On Ubuntu/Debian install

View File

@ -1,12 +1,12 @@
CFLAGS=-I../cube/User/Inc -DTEST
CFLAGS=-I../../cube/User/Inc -DTEST
test: ringbuffer.o test.o
gcc -o $@ -lcunit $^
ringbuffer.o: ../cube/User/Src/ringbuffer.c
ringbuffer.o: ../../cube/User/Src/ringbuffer.c
gcc -c -o $@ $(CFLAGS) $^
logger.o: ../cube/User/Src/logger.c
logger.o: ../../cube/User/Src/logger.c
gcc -c -o $@ $(CFLAGS) $^
test.o: test.c

15
tests/test2/Makefile Normal file
View File

@ -0,0 +1,15 @@
test: test.o
gcc -o $@ $^
test.o: test.c
gcc -c -o $@ $(CFLAGS) $^
.PHONY: run
run: test
./test
.PHONY: clean
clean:
rm -f *.o test

10
tests/test2/test.c Normal file
View File

@ -0,0 +1,10 @@
#include <stdio.h>
#include <stdint.h>
int main() {
uint32_t i = -10;
int32_t j = i;
printf("%lu %d\n", i, j);
}