ggwave : optimize memory footprint even more

This commit is contained in:
Georgi Gerganov
2022-06-11 15:23:02 +03:00
parent 535392d41f
commit 68367c2d09
3 changed files with 45 additions and 27 deletions

View File

@@ -389,6 +389,10 @@ public:
#include <stdint.h>
#include <stdio.h>
#ifdef ARDUINO
#include <avr/pgmspace.h>
#endif
class GGWave {
public:
static constexpr auto kSampleRateMin = 1000.0f;
@@ -480,22 +484,28 @@ public:
protocols.data[i].name = nullptr;
protocols.data[i].enabled = false;
}
#ifndef ARDUINO
#define PSTR(str) (str)
#endif
#ifndef GGWAVE_CONFIG_FEW_PROTOCOLS
protocols.data[GGWAVE_PROTOCOL_AUDIBLE_NORMAL] = { "Normal", 40, 9, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_AUDIBLE_FAST] = { "Fast", 40, 6, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_AUDIBLE_FASTEST] = { "Fastest", 40, 3, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_ULTRASOUND_NORMAL] = { "[U] Normal", 320, 9, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_ULTRASOUND_FAST] = { "[U] Fast", 320, 6, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_ULTRASOUND_FASTEST] = { "[U] Fastest", 320, 3, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_DT_NORMAL] = { "[DT] Normal", 24, 9, 1, 1, true, };
protocols.data[GGWAVE_PROTOCOL_DT_FAST] = { "[DT] Fast", 24, 6, 1, 1, true, };
protocols.data[GGWAVE_PROTOCOL_DT_FASTEST] = { "[DT] Fastest", 24, 3, 1, 1, true, };
protocols.data[GGWAVE_PROTOCOL_AUDIBLE_NORMAL] = { PSTR("Normal"), 40, 9, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_AUDIBLE_FAST] = { PSTR("Fast"), 40, 6, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_AUDIBLE_FASTEST] = { PSTR("Fastest"), 40, 3, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_ULTRASOUND_NORMAL] = { PSTR("[U] Normal"), 320, 9, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_ULTRASOUND_FAST] = { PSTR("[U] Fast"), 320, 6, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_ULTRASOUND_FASTEST] = { PSTR("[U] Fastest"), 320, 3, 3, 1, true, };
protocols.data[GGWAVE_PROTOCOL_DT_NORMAL] = { PSTR("[DT] Normal"), 24, 9, 1, 1, true, };
protocols.data[GGWAVE_PROTOCOL_DT_FAST] = { PSTR("[DT] Fast"), 24, 6, 1, 1, true, };
protocols.data[GGWAVE_PROTOCOL_DT_FASTEST] = { PSTR("[DT] Fastest"), 24, 3, 1, 1, true, };
#endif
protocols.data[GGWAVE_PROTOCOL_MT_NORMAL] = { "[MT] Normal", 24, 9, 1, 2, true, };
protocols.data[GGWAVE_PROTOCOL_MT_FAST] = { "[MT] Fast", 24, 6, 1, 2, true, };
protocols.data[GGWAVE_PROTOCOL_MT_FASTEST] = { "[MT] Fastest", 24, 3, 1, 2, true, };
protocols.data[GGWAVE_PROTOCOL_MT_NORMAL] = { PSTR("[MT] Normal"), 24, 9, 1, 2, true, };
protocols.data[GGWAVE_PROTOCOL_MT_FAST] = { PSTR("[MT] Fast"), 24, 6, 1, 2, true, };
protocols.data[GGWAVE_PROTOCOL_MT_FASTEST] = { PSTR("[MT] Fastest"), 24, 3, 1, 2, true, };
#ifndef ARDUINO
#undef PSTR
#endif
initialized = true;
}