-
Notifications
You must be signed in to change notification settings - Fork 0
/
printminter.h
39 lines (32 loc) · 916 Bytes
/
printminter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef PRINTMINTER_H
#define PRINTMINTER_H
#if defined(ARDUINO)
#include "Arduino.h"
#else
#include <string>
#include <stdlib.h>
#include <stdio.h>
#define String std::string
#define Serial std::cout
//#define endl std::endl
#endif
#define _PRINTMINTER_SPACE_ "..."
#define _PRINTMINTER_FIRST_ 6
#define _PRINTMINTER_LAST_ 4
#define _PRINTMINTER_MX_LENGHT_ 42
#define PRINTMINTER_MX_FROM_START (_PRINTMINTER_MX_LENGHT_ - _PRINTMINTER_LAST_)
class PrintMinter
{
public:
PrintMinter();
String Mx(String mx)
{
#if defined(ARDUINO)
const String str = mx.substring(0, _PRINTMINTER_FIRST_) + _PRINTMINTER_SPACE_ + mx.substring(PRINTMINTER_MX_FROM_START, _PRINTMINTER_MX_LENGHT_);
#else
const String str = mx.substr(0, _PRINTMINTER_FIRST_) + _PRINTMINTER_SPACE_ + mx.substr(PRINTMINTER_MX_FROM_START, _PRINTMINTER_MX_LENGHT_);
#endif
return str;
}
};
#endif // PRINTMINTER_H