-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Labels
Description
I send a photo to telegram via SIM800 and TinyGSM. If the photo is more than 16384b I get an error "bad request: image_process_failed".
Are there any restrictions on the size of the transferred files and how to correctly transfer large files more than 16 KB using the SSLCLIENT library
I am using ESP32-CAM Gsm module sim800l Arduino IDE V2.0.
#define TINY_GSM_MODEM_SIM800
#define CAMERA_MODEL_AI_THINKER
#include <WiFi.h>
#include <TinyGsmClient.h>
#include <TinyGsmClientSIM800.h>
#include <ArduinoHttpClient.h>
#include <SSLClientESP32.h>
#include <camera.h>
#include <FastBot2.h>
#include <ArduinoJson.h>
#include <Arduino.h>
#define BOTtoken "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get from Botfather)
TinyGsm modem(Serial2);
TinyGsmClient client(modem);
SSLClientESP32 telegramSSL(&client);
FastBot2Client bot(telegramSSL);
const char apn[] = ""; //apn
const char user[] = ""; //username
const char pass[] = ""; //pass
void setup()
{
telegramSSL.setCACert(cert);
Serial.begin(115200);
bool res = cam_init(FRAMESIZE_QQVGA, PIXFORMAT_JPEG);
Serial.println(res ? "Camera OK" : "Camera ERROR");
Serial2.begin(115200, SERIAL_8N1, RXD2, TXD2);
Serial.print(F("Waiting for network..."));
if (!modem.waitForNetwork()) {
Serial.println(" fail");
return;
}
Serial.println(" OK");
Serial.print(F("Connecting to "));
Serial.print(apn);
if (!modem.gprsConnect(apn, user, pass)) {
Serial.println(" fail");
return;
} else {
Serial.println(" OK");
}
IPAddress local = modem.localIP();
modem.waitResponse();
Serial.println(local);
bot.setToken(F(BOTtoken));
bot.setPollMode(fb::Poll::Long, 20000);
}
void loop() //put function inside loop if required
{
String chat_id = "123456789";
String text = "hello!";
Serial.println("Send message");
bot.sendMessage(fb::Message("Hello!", chat_id));
delay(1000);
camera_fb_t* fbj = esp_camera_fb_get();
esp_camera_fb_return(fbj);
fbj = esp_camera_fb_get();
if (fbj) {
fb::File f("frame.jpg", fb::File::Type::photo, fbj->buf, fbj->len);
f.chatID = chat_id;
bot.sendFile(f, true);
}
esp_camera_fb_return(fbj);
}