Hi Forum,
ich benutze für ein Projekt einen Telegramm Bot und die SPIFFS.
Aber irgendwie scheinen die sich nicht zu mögen. Sobald ich die SPIFFS in den Code
einbinde, bekommt er keine Telegram Nachrichten mehr und stürzt ab.
hier mein Code:
// Standard C/C++ libraries
#include <string.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <FS.h> // Dateisystem
#include <utlgbotlib.h>
#define WIFI_SSID "xx"
#define WIFI_PASS "xx"
#define TLG_TOKEN "xx"
// Enable Bot debug level (0 - None; 1 - Bot Level; 2 - Bot+HTTPS Level)
#define DEBUG_LEVEL_UTLGBOT 0
/**************************************************************************************************/
/* Functions Prototypes */
void wifi_init_stat(void);
bool wifi_handle_connection(void);
uTLGBot Bot(TLG_TOKEN);
void setup(void)
{
// Enable Bot debug
Bot.set_debug(DEBUG_LEVEL_UTLGBOT);
// Initialize Serial
Serial.begin(115200);
// Initialize WiFi station connection
wifi_init_stat();
// Wait WiFi connection
Serial.println("Waiting for WiFi connection.");
while (!wifi_handle_connection())
{
Serial.println(".");
delay(1000);
}
if (!SPIFFS.begin())
{
// SPIFFS nicht initialisiert!
Serial.println("SPIFFS nicht geladen");
while (true) // ohne SPIFFS geht es sowieso nicht...
yield();
}
// SPIFFS Ok
// Bot getMe command
Bot.getMe();
}
void loop()
{
// Check if WiFi is connected
if (!wifi_handle_connection())
{
// Wait 100ms and check again
delay(100);
return;
}
// Test Bot getUpdate command and receive messages
while (Bot.getUpdates())
{
Serial.println("\n-----------------------------------------");
Serial.println("Received message.");
Serial.printf(" Text: %s\n", Bot.received_msg.text);
Serial.printf("-----------------------------------------\n");
// Feed the Watchdog
yield();
}
// Wait 1s for next iteration
delay(1000);
}
/**************************************************************************************************/
/* Functions */
// Init WiFi interface
void wifi_init_stat(void)
{
Serial.println("Initializing TCP-IP adapter...");
Serial.print("Wifi connecting to SSID: ");
Serial.println(WIFI_SSID);
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASS);
Serial.println("TCP-IP adapter successfuly initialized.");
}
/**************************************************************************************************/
/* WiFi Change Event Handler */
bool wifi_handle_connection(void)
{
static bool wifi_connected = false;
// Device is not connected
if (WiFi.status() != WL_CONNECTED)
{
// Was connected
if (wifi_connected)
{
Serial.println("WiFi disconnected.");
wifi_connected = false;
}
return false;
}
// Device connected
else
{
// Wasn't connected
if (!wifi_connected)
{
Serial.println("");
Serial.println("WiFi connected");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
wifi_connected = true;
}
return true;
}
}
/**************************************************************************************************/
folgendes bekomme ich dann :
xception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads
PC: 0x4021412b: spiffs_cache_page_get(spiffs*, spiffs_page_ix) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\spiffs\spiffs_cache.cpp line 18
EXCVADDR: 0x00000008
Memory allocation of 1400 bytes failed at 0x40209b55: spiffs_impl::SPIFFSImpl::_tryMount() at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/spiffs_api.h line 307
Decoding stack results
0x401007cf: umm_free_core(void*) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 351
0x40100a53: free(void*) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 398
0x4020c9d8: spiffs_obj_lu_scan(spiffs*) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\spiffs\spiffs_nucleus.cpp line 373
0x402113db: std::_Sp_counted_deleter ::_Deleter >, std::allocator , (__gnu_cxx::_Lock_policy)0>::_M_destroy() at c:\users\xx-\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\bits/shared_ptr_base.h line 357
0x40213474: std::__shared_count(__gnu_cxx::_Lock_policy)0>::~__shared_count() at c:\users\xx-\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\bits/shared_ptr_base.h line 547
0x4020b344: SPIFFS_mount(spiffs*, spiffs_config*, u8_t*, u8_t*, u32_t, void*, u32_t, spiffs_check_callback) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\spiffs\spiffs_hydrogen.cpp line 138
0x40209b7d: spiffs_impl::SPIFFSImpl::_tryMount() at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/spiffs_api.h line 320
0x40213ff0: spiffs_impl::SPIFFSImpl::_check_cb(spiffs_check_type, spiffs_check_report, unsigned int, unsigned int) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/spiffs_api.h line 322
0x4020a23d: uart_write(uart_t*, char const*, size_t) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\uart.cpp line 509
0x4020927c: spiffs_impl::SPIFFSImpl::spiffs_hal_read(unsigned int, unsigned int, unsigned char*) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/spiffs_api.h line 344
0x40209260: spiffs_impl::SPIFFSImpl::spiffs_hal_write(unsigned int, unsigned int, unsigned char const*) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/spiffs_api.h line 338
0x40209244: spiffs_impl::SPIFFSImpl::spiffs_hal_erase(unsigned int, unsigned int) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/spiffs_api.h line 341
0x40207260: HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/HardwareSerial.h line 165
0x40207254: HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/HardwareSerial.h line 164
0x40209bc5: spiffs_impl::SPIFFSImpl::begin() at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/spiffs_api.h line 186
0x40213dd5: fs::FS::begin() at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\FS.cpp line 303
0x402022db: setup() at C:\Users\xx-\AppData\Local\Temp\arduino_modified_sketch_219249/show_received_messages.ino line 153
0x402085ac: loop_wrapper() at C:\Users\xx-\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 194
Kann damit jemand etwas anfangen, und mir weiterhelfen?
Danke für die Mühe
Mfg