Skip to content

Commit 6751073

Browse files
committed
modified: library.properties
modified: src/config_ext.h modified: src/esp8266.cpp modified: src/spiffs_fns.cpp modified: src/spiffs_fns.h modified: src/sqlite3.c modified: src/sqlite3.h modified: src/sqlite3ext.h modified: src/vfs.cpp modified: src/vfs.h Prepare first release
1 parent 7047631 commit 6751073

File tree

10 files changed

+3876
-6275
lines changed

10 files changed

+3876
-6275
lines changed

library.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name=Sqlite3
22
version=0.9
33
author=Arundale Ramanathan
44
maintainer=Arun <arun@siara.cc>
5-
sentence=Sqlite3 library for ESP8266
6-
paragraph=
7-
category=Database
8-
url=http://siara.cc/esp8266_sqlite3
5+
sentence=Sqlite3 library for Arduino ESP
6+
paragraph=This Arduino library enables usage of Sqlite3 (v20.01) databases from ESP devices. For further information, please visit the given URL.
7+
category=Data Storage
8+
url=https://github.com/siara-cc/esp_arduino_sqlite3_lib
99
architectures=esp8266

src/config_ext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define _HAVE_SQLITE_CONFIG_H
44
#define SQLITE_CORE 1
55
#define SQLITE_NO_SYNC 1
6-
#define YYSTACKDEPTH 20
6+
#define YYSTACKDEPTH 16
77
#define SQLITE_TEMP_STORE 1
88
#define SQLITE_SYSTEM_MALLOC 1
99
#define SQLITE_OS_OTHER 1

src/esp8266.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern "C" {
3030

3131
extern "C" {
3232
void SerialPrintln(const char *str) {
33-
Serial.println(str);
33+
//Serial.println(str);
3434
}
3535
}
3636

@@ -177,12 +177,10 @@ uint32_t filecache_pull (pFileCache_t cache, uint32_t offset, uint32_t len, uint
177177
uint32_t r = 0;
178178

179179
blocks = ( offset % CACHEBLOCKSZ + len ) / (float) CACHEBLOCKSZ;
180-
SerialPrintln("fcp1");
181180
if (blocks == 0.0)
182181
return 0;
183182
if (!cache->list)
184183
return 0;
185-
SerialPrintln("fcp2");
186184

187185
if (( blocks - (int) blocks) > 0.0)
188186
blocks = blocks + 1.0;

src/spiffs_fns.cpp

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,19 @@
22
#include "spiffs_fns.h"
33
#include <FS.h>
44

5-
File file;
5+
File *filep;
6+
void set_spiffs_file_obj(void *in_filep) {
7+
filep = (File *) in_filep;
8+
}
9+
610
vfs_file *spiffs_open( const char *name, const char *mode ) {
711
vfs_file *ret = (vfs_file *) malloc(sizeof(vfs_file));
812
ret->fs_type = VFS_FS_SPIFFS;
913
ret->file_obj = NULL;
10-
file = SPIFFS.open(name + 6, mode);
11-
if (!file)
14+
*filep = SPIFFS.open(name + 6, mode);
15+
if (!*filep)
1216
return NULL;
13-
ret->file_obj = malloc(sizeof(File));
14-
memcpy(ret->file_obj, &file, sizeof(File));
15-
unsigned char *fo = (unsigned char*) ret->file_obj;
16-
for (int i = 0; i < sizeof(File); i++) {
17-
Serial.print((int)fo[i]);
18-
Serial.print(",");
19-
}
20-
Serial.println();
21-
Serial.print("position:");
22-
Serial.print((unsigned long)ret->file_obj);
23-
Serial.print(((File *)ret->file_obj)->position());
17+
ret->file_obj = filep;
2418
return ret;
2519
}
2620

@@ -37,10 +31,6 @@ sint32_t spiffs_exists( const char *name ) {
3731
}
3832

3933
sint32_t spiffs_close( vfs_file *fd ) {
40-
if (fd->file_obj) {
41-
((File *)fd->file_obj)->close();
42-
free(fd->file_obj);
43-
}
4434
free(fd);
4535
return VFS_RES_OK;
4636
}
@@ -60,13 +50,6 @@ sint32_t spiffs_write( vfs_file *fd, const void *ptr, size_t len ) {
6050
}
6151

6252
sint32_t spiffs_lseek( vfs_file *fd, sint32_t off, int whence ) {
63-
Serial.print("position:");
64-
Serial.print((unsigned long)fd->file_obj);
65-
Serial.print(file.position());
66-
if (((File *)fd->file_obj)->size() < off)
67-
return VFS_RES_ERR;
68-
if (((File *)fd->file_obj)->position() == off)
69-
return off;
7053
if ( ((File *)fd->file_obj)->seek(off,
7154
(whence == VFS_SEEK_SET ? SeekSet : (whence == VFS_SEEK_CUR ? SeekCur : SeekEnd))) )
7255
return off;

src/spiffs_fns.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "vfs_int.h"
55

6+
void set_spiffs_file_obj(void *in_filep);
67
vfs_file *spiffs_open( const char *name, const char *mode );
78
sint32_t spiffs_remove( const char *name );
89
sint32_t spiffs_exists( const char *name );

0 commit comments

Comments
 (0)