ESP32 มีปัญญหากับ Library Trident

ผมกำลังทำมินิโปรเจค เกี่ยวกับไฟหลังบ้านอยู่ครับ โดยส่วนที่มีปัญหาคือ Line Notify
Error

Library TridentTD_Linenotify has been declared precompiled:
Using precompiled library in c:\Arduino\libraries\TridentTD_Linenotify\src\esp32
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: c:\Arduino\libraries\TridentTD_Linenotify\src\esp32\libTridentTD_LineNotify.a(TridentTD_LineNotify.cpp.o):(.literal._ZN20TridentTD_LineNotify7_notifyE6StringiiS0_RN2fs2FSES0_Phj+0x70): undefined reference to `WiFiClientSecure::WiFiClientSecure()' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: c:\Arduino\libraries\TridentTD_Linenotify\src\esp32\libTridentTD_LineNotify.a(TridentTD_LineNotify.cpp.o):(.literal._ZN20TridentTD_LineNotify7_notifyE6StringiiS0_RN2fs2FSES0_Phj+0x74): undefined reference to `WiFiClientSecure::setInsecure()’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: c:\Arduino\libraries\TridentTD_Linenotify\src\esp32\libTridentTD_LineNotify.a(TridentTD_LineNotify.cpp.o):(.literal._ZN20TridentTD_LineNotify7_notifyE6StringiiS0_RN2fs2FSES0_Phj+0x78): undefined reference to `WiFiClientSecure::connect(char const*, unsigned short)' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: c:\Arduino\libraries\TridentTD_Linenotify\src\esp32\libTridentTD_LineNotify.a(TridentTD_LineNotify.cpp.o):(.literal._ZN20TridentTD_LineNotify7_notifyE6StringiiS0_RN2fs2FSES0_Phj+0xa4): undefined reference to `WiFiClientSecure::stop()’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: c:\Arduino\libraries\TridentTD_Linenotify\src\esp32\libTridentTD_LineNotify.a(TridentTD_LineNotify.cpp.o):(.literal._ZN20TridentTD_LineNotify7_notifyE6StringiiS0_RN2fs2FSES0_Phj+0xb4): undefined reference to `WiFiClientSecure::write(unsigned char const*, unsigned int)' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: c:\Arduino\libraries\TridentTD_Linenotify\src\esp32\libTridentTD_LineNotify.a(TridentTD_LineNotify.cpp.o):(.literal._ZN20TridentTD_LineNotify7_notifyE6StringiiS0_RN2fs2FSES0_Phj+0xb8): undefined reference to `WiFiClientSecure::connected()’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: c:\Arduino\libraries\TridentTD_Linenotify\src\esp32\libTridentTD_LineNotify.a(TridentTD_LineNotify.cpp.o):(.literal._ZN20TridentTD_LineNotify7_notifyE6StringiiS0_RN2fs2FSES0_Phj+0xc0): undefined reference to `WiFiClientSecure::available()' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: c:\Arduino\libraries\TridentTD_Linenotify\src\esp32\libTridentTD_LineNotify.a(TridentTD_LineNotify.cpp.o):(.literal._ZN20TridentTD_LineNotify7_notifyE6StringiiS0_RN2fs2FSES0_Phj+0xd8): undefined reference to `WiFiClientSecure::~WiFiClientSecure()’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: c:\Arduino\libraries\TridentTD_Linenotify\src\esp32\libTridentTD_LineNotify.a(TridentTD_LineNotify.cpp.o): in function `TridentTD_LineNotify::_notify(String, int, int, String, fs::FS&, String, unsigned char*, unsigned int)': D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:121: undefined reference to `WiFiClientSecure::WiFiClientSecure()’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:123: undefined reference to `WiFiClientSecure::setInsecure()' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:127: undefined reference to `WiFiClientSecure::connect(char const*, unsigned short)’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:236: undefined reference to `WiFiClientSecure::stop()' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:201: undefined reference to `WiFiClientSecure::write(unsigned char const*, unsigned int)’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:205: undefined reference to `WiFiClientSecure::write(unsigned char const*, unsigned int)' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:216: undefined reference to `WiFiClientSecure::write(unsigned char const*, unsigned int)’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:219: undefined reference to `WiFiClientSecure::write(unsigned char const*, unsigned int)' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:227: undefined reference to `WiFiClientSecure::connected()’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:228: undefined reference to `WiFiClientSecure::connected()' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:227: undefined reference to `WiFiClientSecure::available()’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:228: undefined reference to `WiFiClientSecure::available()' c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:121: undefined reference to `WiFiClientSecure::~WiFiClientSecure()’
c:/users/notno/appdata/local/arduino15/packages/esp32/tools/esp-x32/2302/bin/…/lib/gcc/xtensa-esp32-elf/12.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: D:\Arduino\ArduinoSketch\libraries\TridentTD_LineNotify\src/TridentTD_LineNotify.cpp:121: undefined reference to `WiFiClientSecure::~WiFiClientSecure()’
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

อันนี้เป็นโค๊ดที่เขียน

#include <WiFi.h>
#include “esp_camera.h”
#include “esp_system.h”
#include <TridentTD_LineNotify.h>

// WiFi and Line Notify credentials
#define SSID “nena_2.4G” // WiFi name
#define PASSWORD “0611732140” // PASSWORD
#define LINE_TOKEN “3Dsb1amcL4Q09W6cT0pHsfsG0Qm6Xa9AMOX9AhkOvrm” // Line token

// Pin definition for CAMERA_MODEL_AI_THINKER
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22

// Ultrasonic Sensor Pins
const int trigPin = 18; // Pin Trig ของ Ultrasonic Sensor
const int echoPin = 19; // Pin Echo ของ Ultrasonic Sensor
const int relay = 26; // Pin ที่ควบคุมรีเลย์
const int Led_Flash = 4; // LED Flash for ESP32-CAM
const int Led_run = 13; // Running LED

long duration;
int distance;
int threshold = 15; // ระยะทางที่จะเปิดรีเลย์ (เซนติเมตร)
bool objectDetected = false; // สถานะการตรวจจับวัตถุ

unsigned long previousMillis = 0; // เวลาเก็บการตรวจจับวัตถุครั้งสุดท้าย
const long delayTime = 10000; // 10 วินาที (10000 มิลลิวินาที)

void setup() {
Serial.begin(115200);
pinMode(Led_Flash, OUTPUT);
pinMode(Led_run, OUTPUT);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(relay, OUTPUT);

WiFi.begin(SSID, PASSWORD);
Serial.printf(“WiFi connecting to %s\n”, SSID);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(“.”);
delay(400);
}
Serial.printf("\nWiFi connected\nIP : ");
Serial.println(WiFi.localIP());
LINE.setToken(LINE_TOKEN);

// Camera Configuration
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;

if (psramFound()) {
config.frame_size = FRAMESIZE_VGA;
config.jpeg_quality = 10;
config.fb_count = 2;
} else {
config.frame_size = FRAMESIZE_QQVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}

// Init Camera
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf(“Camera init failed with error 0x%x”, err);
return;
}
}

void loop() {
long tme = millis();

// ตรวจจับระยะทางด้วย Ultrasonic Sensor
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(5);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;

// ตรวจสอบระยะทางแล้วสั่งถ่ายภาพและเปิดรีเลย์
if (distance < threshold && !objectDetected) {
digitalWrite(relay, HIGH); // เปิดรีเลย์
Camera_capture(); // ถ่ายภาพ
objectDetected = true; // ตั้งค่าสถานะว่ามีวัตถุ
previousMillis = millis(); // บันทึกเวลาตรวจจับล่าสุด
Serial.println(“Object detected, Relay ON”);
}

// ถ้าผ่านเวลา 10 วินาทีแล้วให้ปิดรีเลย์
if (objectDetected && (millis() - previousMillis >= delayTime)) {
digitalWrite(relay, LOW); // ปิดรีเลย์
objectDetected = false; // รีเซ็ตสถานะ
Serial.println(“Relay OFF”);
}

// แสดงสถานะ LED
if (millis() > tme + 1000) {
digitalWrite(Led_run, HIGH);
delay(20);
digitalWrite(Led_run, LOW);
}
}

void Camera_capture() {
digitalWrite(Led_Flash, HIGH);
delay(100);
digitalWrite(Led_Flash, LOW);
delay(100);
digitalWrite(Led_Flash, HIGH);

camera_fb_t * fb = NULL;
fb = esp_camera_fb_get();
if (!fb) {
Serial.println(“Camera capture failed”);
return;
}
digitalWrite(Led_Flash, LOW);
Send_line(fb->buf, fb->len);
esp_camera_fb_return(fb);
}

void Send_line(uint8_t *image_data, size_t image_size) {
LINE.notifyPicture(“ตรวจพบการเคลื่อนไหว”, image_data, image_size);
}

เพิ่มการ include ของ WiFiClientSecure ในโค้ด

ลองเพิ่มการ include ไลบรารี WiFiClientSecure ลงในโค้ดโดยตรงเพื่อให้แน่ใจว่าเครื่องมือเชื่อมโยง (linker) สามารถหาได้:

#include <WiFiClientSecure.h>