Skip to content

Commit 1e2d609

Browse files
fix Telegram include error
1 parent 8405e9a commit 1e2d609

File tree

7 files changed

+231
-2
lines changed

7 files changed

+231
-2
lines changed

src/eloquent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef ELOQUENTARDUINO_ELOQUENT_H
22
#define ELOQUENTARDUINO_ELOQUENT_H
33

4+
45
// entry point for the Eloquent Arduino library
56
#include "./eloquent/utils.h"
67

src/eloquent/apps/telegram/bot/BaseTelegramBot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#pragma once
66

7-
#ifndef NO_TELEGRAM
7+
#ifdef ELOQUENT_TELEGRAM
88

99
#include "./witnessmenow/UniversalTelegramBot.h"
1010
#include "./Errors.h"

src/eloquent/apps/telegram/bot/wifi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#pragma once
66

7-
#ifndef NO_TELEGRAM
7+
#ifdef ELOQUENT_TELEGRAM
88

99
#include <WiFiClientSecure.h>
1010
#include "../../../macros.h"

src/eloquent/apps/telegram/bot/witnessmenow/UniversalTelegramBot.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
SSL errors
3434
*/
3535

36+
#ifdef ELOQUENT_TELEGRAM
3637
#include "./UniversalTelegramBot.h"
3738

3839
#define ZERO_COPY(STR) ((char*)STR.c_str())
@@ -683,3 +684,5 @@ bool UniversalTelegramBot::answerCallbackQuery(const String &query_id, const Str
683684
closeClient();
684685
return answer;
685686
}
687+
688+
#endif

src/eloquent/apps/telegram/bot/witnessmenow/UniversalTelegramBot.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ License along with this library; if not, write to the Free Software
1919
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2020
*/
2121

22+
#ifdef ELOQUENT_TELEGRAM
23+
2224
#ifndef UniversalTelegramBot_h
2325
#define UniversalTelegramBot_h
2426

@@ -236,3 +238,4 @@ class UniversalTelegramBot {
236238
};
237239

238240
#endif
241+
#endif

src/eloquent/vision/camera/portenta.h

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
//
2+
// Created by Simone on 20/07/2022.
3+
//
4+
5+
#pragma once
6+
7+
8+
#include <camera.h>
9+
#include <himax.h>
10+
#include "../../macros.h"
11+
12+
13+
namespace Eloquent {
14+
namespace Vision {
15+
namespace Cam {
16+
class PortentaCamera {
17+
public:
18+
19+
/**
20+
*
21+
*/
22+
PortentaCamera() :
23+
isBegin(false),
24+
cam(himax) {
25+
grayscale();
26+
setFPS(30);
27+
setTimeout(100);
28+
}
29+
30+
/**
31+
* Set grayscale mode
32+
* Call before begin()
33+
*
34+
*/
35+
void grayscale() {
36+
mode = CAMERA_GRAYSCALE;
37+
}
38+
39+
/**
40+
* Set RGB565 mode
41+
* Call before begin()
42+
*
43+
*/
44+
void rgb565() {
45+
mode = CAMERA_RGB565;
46+
}
47+
48+
/**
49+
* Set FPS
50+
*
51+
* @param fps
52+
*/
53+
void setFPS(uint8_t fps) {
54+
this->fps = fps;
55+
}
56+
57+
/**
58+
* Set capture timeout, in milliseconds
59+
*
60+
* @param timeout
61+
*/
62+
void setTimeout(uint16_t timeout) {
63+
this->timeout = timeout;
64+
}
65+
66+
/**
67+
* Init camera
68+
*
69+
* @return
70+
*/
71+
bool begin() {
72+
cam.debug(Serial);
73+
cam.begin(CAMERA_R320x240, mode, fps);
74+
75+
return true;
76+
}
77+
78+
/**
79+
* Capture frame
80+
*
81+
* @return
82+
*/
83+
bool capture() {
84+
if (!isBegin)
85+
isBegin = begin();
86+
87+
if (!isBegin)
88+
return false;
89+
90+
return cam.grabFrame(buffer, 50) == 0;
91+
}
92+
93+
/**
94+
* Release buffer
95+
*
96+
*/
97+
void free() {
98+
// do nothing
99+
}
100+
101+
protected:
102+
bool isBegin;
103+
int mode;
104+
uint8_t fps;
105+
uint16_t timeout;
106+
HM01B0 himax;
107+
Camera cam;
108+
FrameBuffer buffer;
109+
};
110+
}
111+
}
112+
}
113+
114+
ELOQUENT_SINGLETON(Eloquent::Vision::Cam::PortentaCamera camera);
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
//
2+
// Created by Simone on 20/07/2022.
3+
//
4+
5+
#pragma once
6+
7+
8+
#include <camera.h>
9+
#include <himax.h>
10+
#include "../../macros.h"
11+
12+
13+
HM01B0 himax;
14+
FrameBuffer buffer(320, 240, 2);
15+
16+
17+
namespace Eloquent {
18+
namespace Vision {
19+
namespace Cam {
20+
class PortentaCamera : public Camera {
21+
public:
22+
23+
/**
24+
*
25+
*/
26+
PortentaCamera() :
27+
Camera(himax),
28+
isBegin(false) {
29+
grayscale();
30+
setFPS(30);
31+
setTimeout(100);
32+
}
33+
34+
/**
35+
* Set grayscale mode
36+
* Call before begin()
37+
*
38+
*/
39+
void grayscale() {
40+
mode = CAMERA_GRAYSCALE;
41+
}
42+
43+
/**
44+
* Set RGB565 mode
45+
* Call before begin()
46+
*
47+
*/
48+
void rgb565() {
49+
mode = CAMERA_RGB565;
50+
}
51+
52+
/**
53+
* Set FPS
54+
*
55+
* @param fps
56+
*/
57+
void setFPS(uint8_t fps) {
58+
this->fps = fps;
59+
}
60+
61+
/**
62+
* Set capture timeout, in milliseconds
63+
*
64+
* @param timeout
65+
*/
66+
void setTimeout(uint16_t timeout) {
67+
this->timeout = timeout;
68+
}
69+
70+
/**
71+
* Init camera
72+
*
73+
* @return
74+
*/
75+
bool begin() {
76+
Camera::begin(CAMERA_R320x240, CAMERA_GRAYSCALE, 30);
77+
78+
return true;
79+
}
80+
81+
/**
82+
* Capture frame
83+
*
84+
* @return
85+
*/
86+
bool capture() {
87+
return grabFrame(buffer, 50) == 0;
88+
}
89+
90+
/**
91+
* Release buffer
92+
*
93+
*/
94+
void free() {
95+
// do nothing
96+
}
97+
98+
protected:
99+
bool isBegin;
100+
int mode;
101+
uint8_t fps;
102+
uint16_t timeout;
103+
};
104+
}
105+
}
106+
}
107+
108+
ELOQUENT_SINGLETON(Eloquent::Vision::Cam::PortentaCamera camera);

0 commit comments

Comments
 (0)