Save memory on Olimexino boards by removing LFN support

This commit is contained in:
Gordon Williams 2014-05-15 15:08:22 +01:00
parent 4f0ca7c3cb
commit c87697c231
5 changed files with 16 additions and 8 deletions

View File

@ -89,7 +89,13 @@
/ 1 - ASCII (Valid for only non-LFN cfg.) */
#define _USE_LFN 2 /* 0 to 3 */
#ifdef SAVE_ON_FLASH
// sadly, codepages use up a bunch of memory
#define _USE_LFN 0 /* 0 to 3 */
#else
#define _USE_LFN 2 /* 0 to 3 */
#endif
#define _MAX_LFN 63 /* Maximum LFN length to handle (12 to 255) */
/* The _USE_LFN option switches the LFN feature.
/

View File

@ -336,7 +336,7 @@ void jswrap_file_skip(JsVar* parent, int length) {
if (res) jsfsReportError("Unable to skip", res);
}
/*JSON{ "type" : "method", "class" : "File", "name" : "pipe",
/*JSON{ "type" : "method", "class" : "File", "name" : "pipe", "ifndef" : "SAVE_ON_FLASH",
"generate" : "jswrap_pipe",
"description" : [ "Pipe this file to a stream (and object with a 'write' method)"],
"params" : [ ["destination", "JsVar", "The destination file/stream that will receive content from the source."],

View File

@ -143,10 +143,12 @@ JsVar *jswrap_fs_readdir(JsVar *path) {
#ifndef LINUX
DIR dirs;
if ((res=f_opendir(&dirs, pathStr)) == FR_OK) {
char lfnBuf[_MAX_LFN+1];
FILINFO Finfo;
#if _USE_LFN!=0
char lfnBuf[_MAX_LFN+1];
Finfo.lfname = lfnBuf;
Finfo.lfsize = sizeof(lfnBuf);
#endif
#else
DIR *dir = opendir(pathStr);
if(dir) {

View File

@ -29,7 +29,7 @@
#include "jswrap_pipe.h"
#include "jswrap_object.h"
/*JSON{ "type":"library",
/*JSON{ "type":"library", "ifndef" : "SAVE_ON_FLASH",
"class" : "Pipe",
"description" : ["This is the Pipe container for async related IO." ]
}*/
@ -123,7 +123,7 @@ static bool handlePipe(JsVar *arr, JsvArrayIterator *it, JsVar* pipe) {
return dataTransferred;
}
/*JSON{ "type":"idle", "generate" : "jswrap_pipe_idle" }*/
/*JSON{ "type":"idle", "generate" : "jswrap_pipe_idle", "ifndef" : "SAVE_ON_FLASH" }*/
bool jswrap_pipe_idle() {
bool wasBusy = false;
JsVar *arr = PipeGetArray(JS_HIDDEN_CHAR_STR"OpenPipes",false);
@ -142,7 +142,7 @@ bool jswrap_pipe_idle() {
return wasBusy;
}
/*JSON{ "type":"kill", "generate" : "jswrap_pipe_kill" }*/
/*JSON{ "type":"kill", "generate" : "jswrap_pipe_kill", "ifndef" : "SAVE_ON_FLASH" }*/
void jswrap_pipe_kill() {
// now remove all pipes...
JsVar *arr = PipeGetArray(JS_HIDDEN_CHAR_STR"OpenPipes", false);
@ -200,7 +200,7 @@ static void jswrap_pipe_close_listener(JsVar *destination) {
}
}
/*JSON{ "type" : "staticmethod", "class" : "fs", "name" : "pipe",
/*JSON{ "type" : "staticmethod", "class" : "fs", "name" : "pipe", "ifndef" : "SAVE_ON_FLASH",
"generate" : "jswrap_pipe",
"params" : [ ["source", "JsVar", "The source file/stream that will send content."],
["destination", "JsVar", "The destination file/stream that will receive content from the source."],

View File

@ -103,7 +103,7 @@ JsVarFloat jswrap_math_abs(JsVarFloat x) {
"params" : [ [ "x", "float", "The value to get the arc tangent of"] ],
"return" : ["float", "The arc tangent of x, between -PI/2 and PI/2"]
}*/
/*JSON{ "type":"staticmethod",
/*JSON{ "type":"staticmethod", "ifndef" : "SAVE_ON_FLASH",
"class" : "Math", "name" : "atan2",
"generate" : "atan2",
"params" : [ [ "y", "float", "The Y-part of the angle to get the arc tangent of"],