Fixed currency conversion between nordic currencies

This commit is contained in:
Gunnar Skjold 2022-06-04 10:28:23 +02:00
parent d9a5a21fe0
commit 0dca85d67b
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,5 @@
#include "DnbCurrParser.h"
#include "Arduino.h"
#include "HardwareSerial.h"
float DnbCurrParser::getValue() {
return value;
@ -30,13 +29,14 @@ size_t DnbCurrParser::write(const uint8_t *buffer, size_t size) {
}
size_t DnbCurrParser::write(uint8_t byte) {
if(pos >= 64) pos = 0;
if(pos >= 128) pos = 0;
if(pos == 0) {
if(byte == '<') {
buf[pos++] = byte;
}
} else if(byte == '>') {
buf[pos++] = byte;
buf[pos++] = '\0';
if(strncmp(buf, "<Series", 7) == 0) {
for(int i = 0; i < pos; i++) {
if(strncmp(buf+i, "UNIT_MULT=\"", 11) == 0) {

View File

@ -18,7 +18,7 @@ private:
uint8_t scale = 0;
float value = 1.0;
char buf[64];
char buf[128];
uint8_t pos = 0;
uint8_t mode = 0;
};