moved helper utils to seperate file

This commit is contained in:
Paul
2019-10-12 13:10:30 +02:00
parent 460b5fdb61
commit e2dec6654a
2 changed files with 291 additions and 0 deletions

29
src/ems_utils.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* Generic utils
*
* Paul Derbyshire - https://github.com/proddy/EMS-ESP
*
*/
#pragma once
#include "MyESP.h"
#include "ems.h"
#define myDebug(...) myESP.myDebug(__VA_ARGS__)
#define myDebug_P(...) myESP.myDebug_P(__VA_ARGS__)
char * _float_to_char(char * a, float f, uint8_t precision = 2);
char * _bool_to_char(char * s, uint8_t value);
char * _short_to_char(char * s, int16_t value, uint8_t decimals = 1);
char * _ushort_to_char(char * s, uint16_t value, uint8_t decimals = 1);
void _renderShortValue(const char * prefix, const char * postfix, int16_t value, uint8_t decimals = 1);
void _renderUShortValue(const char * prefix, const char * postfix, uint16_t value, uint8_t decimals = 1);
char * _int_to_char(char * s, uint8_t value, uint8_t div = 1);
void _renderIntValue(const char * prefix, const char * postfix, uint8_t value, uint8_t div = 1);
void _renderLongValue(const char * prefix, const char * postfix, uint32_t value);
void _renderBoolValue(const char * prefix, uint8_t value);
char * _hextoa(uint8_t value, char * buffer);
char * _smallitoa(uint8_t value, char * buffer);
char * _smallitoa3(uint16_t value, char * buffer);