@@ -11,7 +11,7 @@ using namespace Pinetime::Controllers;
1111
1212/* * Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/ppg.py */
1313namespace {
14- int Compare (int * d1, int * d2, size_t count) {
14+ int Compare (int8_t * d1, int8_t * d2, size_t count) {
1515 int e = 0 ;
1616 for (size_t i = 0 ; i < count; i++) {
1717 auto d = d1[i] - d2[i];
@@ -20,11 +20,11 @@ namespace {
2020 return e;
2121 }
2222
23- int CompareShift (int * d, int shift, size_t count) {
23+ int CompareShift (int8_t * d, int shift, size_t count) {
2424 return Compare (d + shift, d, count - shift);
2525 }
2626
27- int Trough (int * d, size_t size, float mn, float mx) {
27+ int Trough (int8_t * d, size_t size, uint8_t mn, uint8_t mx) {
2828 auto z2 = CompareShift (d, mn - 2 , size);
2929 auto z1 = CompareShift (d, mn - 1 , size);
3030 for (int i = mn; i < mx + 1 ; i++) {
@@ -45,13 +45,13 @@ Ppg::Ppg(float spl)
4545 lpf {0.11595249 , 0.23190498 , 0.11595249 , -0.72168143 , 0.18549138 } {
4646}
4747
48- int Ppg::Preprocess (float spl) {
48+ int8_t Ppg::Preprocess (float spl) {
4949 spl -= offset;
5050 spl = hpf.Step (spl);
5151 spl = agc.Step (spl);
5252 spl = lpf.Step (spl);
5353
54- auto spl_int = static_cast <int >(spl);
54+ auto spl_int = static_cast <int8_t >(spl);
5555
5656 if (dataIndex < 200 )
5757 data[dataIndex++] = spl_int;
0 commit comments