mirror of
https://github.com/Oleg-Stepanenko-owo/IEBUS
synced 2025-06-28 18:26:24 +00:00
remove all logs from work code
This commit is contained in:
parent
87b9851a29
commit
baf4818bcf
@ -1,10 +1,6 @@
|
|||||||
#include "AVCLanDrv.h"
|
#include "AVCLanDrv.h"
|
||||||
#include "AVCLanHonda.h"
|
#include "AVCLanHonda.h"
|
||||||
//#include "BuffSerial.h"
|
|
||||||
#include "SD_Log.h"
|
|
||||||
|
|
||||||
// AVCLan driver & timer2 init,
|
|
||||||
// char buff[80] = {0};
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
void AVCLanDrv::begin ()
|
void AVCLanDrv::begin ()
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
#include "limits.h"
|
#include "limits.h"
|
||||||
#include <EEPROM.h>
|
|
||||||
#include "AVCLanDrv.h"
|
#include "AVCLanDrv.h"
|
||||||
#include "AVCLanHonda.h"
|
#include "AVCLanHonda.h"
|
||||||
//#include "BuffSerial.h"
|
|
||||||
#include "SD_Log.h"
|
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -41,18 +39,6 @@ const AvcInCmdTable mtSearchHead[] PROGMEM = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const byte mtSearchHeadSize = sizeof(mtSearchHead) / sizeof(AvcInCmdTable);
|
const byte mtSearchHeadSize = sizeof(mtSearchHead) / sizeof(AvcInCmdTable);
|
||||||
//char logBuff[40] = {0};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void printAvcAction( AvcActionID id )
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
//if (!bSDLog.bRedyToLog) return;
|
|
||||||
|
|
||||||
// char mBuff[20] = { 0 };
|
|
||||||
// sprintf( mBuff, "[%u]{%d}", millis(), id );
|
|
||||||
// bSDLog.logs( mBuff );
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
void AVCLanHonda::begin()
|
void AVCLanHonda::begin()
|
||||||
@ -61,7 +47,7 @@ void AVCLanHonda::begin()
|
|||||||
avclan.deviceAddress = 0x0131;
|
avclan.deviceAddress = 0x0131;
|
||||||
|
|
||||||
bShowHondaDisp = false;
|
bShowHondaDisp = false;
|
||||||
isHondaDisLast = false;
|
bHondaDisLast = false;
|
||||||
bShowRearCam = false;
|
bShowRearCam = false;
|
||||||
bFirstStart_20 = true;
|
bFirstStart_20 = true;
|
||||||
|
|
||||||
@ -80,28 +66,16 @@ void AVCLanHonda::setWaitTime( const unsigned long mTime )
|
|||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
waitTime = mTime;
|
waitTime = mTime;
|
||||||
if ( mTime > 0L ) {
|
bWait = (bool) waitTime;
|
||||||
bWait = true;
|
|
||||||
} else {
|
|
||||||
bWait = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////--------------------------------------------------------------------------------
|
// Use the last received message to determine the corresponding action ID,
|
||||||
//void AVCLanHonda::setLockTime( const unsigned long mTime )
|
// store it in avclan object
|
||||||
////--------------------------------------------------------------------------------
|
|
||||||
//{
|
|
||||||
// lockTime = mTime;
|
|
||||||
// bLock = true;
|
|
||||||
// setWaitTime(0L);
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Use the last received message to determine the corresponding action ID, store it in avclan object
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
void AVCLanHonda::getActionID()
|
void AVCLanHonda::getActionID()
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
avclan.actionID = avclan.getActionID(mtSearchHead, mtSearchHeadSize);
|
avclan.actionID = avclan.getActionID( mtSearchHead, mtSearchHeadSize );
|
||||||
};
|
};
|
||||||
|
|
||||||
// process action
|
// process action
|
||||||
@ -111,7 +85,7 @@ void AVCLanHonda::processAction( AvcActionID ActionID )
|
|||||||
{
|
{
|
||||||
if ( bFirstStart_20 && (20000 > millis()) && (ACT_CAM_ON == ActionID) ) {
|
if ( bFirstStart_20 && (20000 > millis()) && (ACT_CAM_ON == ActionID) ) {
|
||||||
bShowRearCam = true;
|
bShowRearCam = true;
|
||||||
isHondaDisLast = false;
|
bHondaDisLast = false; //after reverse action should be GVN screen
|
||||||
bShowHondaDisp = true;
|
bShowHondaDisp = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -131,27 +105,22 @@ void AVCLanHonda::processAction( AvcActionID ActionID )
|
|||||||
break;
|
break;
|
||||||
case ACT_CAM_ON:
|
case ACT_CAM_ON:
|
||||||
bShowRearCam = true;
|
bShowRearCam = true;
|
||||||
isHondaDisLast = isShowHondaDisp();
|
bHondaDisLast = isShowHondaDisp();
|
||||||
bShowHondaDisp = true;
|
bShowHondaDisp = true;
|
||||||
setWaitTime(0L);
|
setWaitTime(0L);
|
||||||
// setLockTime( (unsigned long)(millis() + LOCK_TIME) );
|
|
||||||
break;
|
break;
|
||||||
case ACT_DISP_OFF:
|
case ACT_DISP_OFF:
|
||||||
if ( !bShowRearCam )
|
if ( !bShowRearCam )
|
||||||
{
|
{
|
||||||
bShowHondaDisp = false;
|
bShowHondaDisp = false;
|
||||||
isHondaDisLast = false;
|
bHondaDisLast = false;
|
||||||
setWaitTime(0L);
|
setWaitTime(0L);
|
||||||
// printAvcAction(ActionID);
|
|
||||||
// setLockTime( (unsigned long)(millis() + LOCK_TIME) );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACT_CAM_OFF:
|
case ACT_CAM_OFF:
|
||||||
bShowRearCam = false;
|
bShowRearCam = false;
|
||||||
bShowHondaDisp = isHondaDisLast;
|
bShowHondaDisp = bHondaDisLast;
|
||||||
setWaitTime(0L);
|
setWaitTime(0L);
|
||||||
// printAvcAction(ActionID);
|
|
||||||
// setLockTime( (unsigned long)(millis() + LOCK_TIME) );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -176,27 +145,19 @@ bool AVCLanHonda::getCommute()
|
|||||||
void AVCLanHonda::tryToShowHondaDisp()
|
void AVCLanHonda::tryToShowHondaDisp()
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
// if ( isLockTime() ) return;
|
bHondaDisLast = bShowHondaDisp;
|
||||||
bShowHondaDisp = true;
|
bShowHondaDisp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
void AVCLanHonda::falseHondaDis()
|
void AVCLanHonda::setHondaDis( bool val )
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
bShowHondaDisp = false;
|
bShowHondaDisp = val;
|
||||||
isHondaDisLast = false;
|
bHondaDisLast = val;
|
||||||
|
setWaitTime(0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
////--------------------------------------------------------------------------------
|
|
||||||
//bool AVCLanHonda::isLockTime()
|
|
||||||
////--------------------------------------------------------------------------------
|
|
||||||
//{
|
|
||||||
// if ( bLock ) {
|
|
||||||
// bLock = ( getLockTime() > millis() );
|
|
||||||
// }
|
|
||||||
// return bLock;
|
|
||||||
//}
|
|
||||||
|
|
||||||
AVCLanHonda avclanHonda;
|
AVCLanHonda avclanHonda;
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#define DISABLE_TIMER1_INT (cbi(TIMSK1, TOIE1));
|
#define DISABLE_TIMER1_INT (cbi(TIMSK1, TOIE1));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Р°РТвЂ<D0B2>реса eeprom
|
|
||||||
#define E_MASTER1 0
|
#define E_MASTER1 0
|
||||||
#define E_MASTER2 1
|
#define E_MASTER2 1
|
||||||
#define E_READONLY 2
|
#define E_READONLY 2
|
||||||
@ -28,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define AVCLANDEVICE_NAME " Honda Kb1"
|
#define AVCLANDEVICE_NAME " Honda Kb1"
|
||||||
#define AVCLANDEVICE_VERSION "0.0.8"
|
#define AVCLANDEVICE_VERSION "0.1.0"
|
||||||
|
|
||||||
#define BUTT_WAIT 1000
|
#define BUTT_WAIT 1000
|
||||||
#define LOCK_TIME 700
|
#define LOCK_TIME 700
|
||||||
@ -66,11 +65,6 @@ class AVCLanHonda
|
|||||||
void setWaitTime( const unsigned long mTime );
|
void setWaitTime( const unsigned long mTime );
|
||||||
inline unsigned long getWaitTime() const;
|
inline unsigned long getWaitTime() const;
|
||||||
|
|
||||||
// void setLockTime( const unsigned long mTime );
|
|
||||||
// inline unsigned long getLockTime() const;
|
|
||||||
// bool isLockTime();
|
|
||||||
|
|
||||||
|
|
||||||
inline bool isWait() const;
|
inline bool isWait() const;
|
||||||
|
|
||||||
inline bool isShowRearCam() const;
|
inline bool isShowRearCam() const;
|
||||||
@ -78,7 +72,7 @@ class AVCLanHonda
|
|||||||
|
|
||||||
void checkWait();
|
void checkWait();
|
||||||
void checkLock();
|
void checkLock();
|
||||||
void falseHondaDis();
|
void setHondaDis( bool val );
|
||||||
|
|
||||||
bool bFirstStart_20;
|
bool bFirstStart_20;
|
||||||
|
|
||||||
@ -92,13 +86,9 @@ class AVCLanHonda
|
|||||||
bool bShowRearCam;
|
bool bShowRearCam;
|
||||||
bool bShowHondaDisp;
|
bool bShowHondaDisp;
|
||||||
bool bTimeSwitch;
|
bool bTimeSwitch;
|
||||||
bool isHondaDisLast;
|
bool bHondaDisLast;
|
||||||
};
|
};
|
||||||
|
|
||||||
//unsigned long AVCLanHonda::getLockTime() const {
|
|
||||||
// return lockTime;
|
|
||||||
//}
|
|
||||||
|
|
||||||
unsigned long AVCLanHonda::getWaitTime() const {
|
unsigned long AVCLanHonda::getWaitTime() const {
|
||||||
return waitTime;
|
return waitTime;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
#include <EEPROM.h>
|
|
||||||
#include <SD.h>
|
|
||||||
#include <SPI.h>
|
|
||||||
#include "AVCLanDrv.h"
|
#include "AVCLanDrv.h"
|
||||||
#include "AVCLanHonda.h"
|
#include "AVCLanHonda.h"
|
||||||
//#include "BuffSerial.h"
|
|
||||||
#include "SD_Log.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -24,28 +18,19 @@ void setup()
|
|||||||
sbi(LED_DDR, COMMUT_OUT);
|
sbi(LED_DDR, COMMUT_OUT);
|
||||||
cbi(LED_PORT, COMMUT_OUT);
|
cbi(LED_PORT, COMMUT_OUT);
|
||||||
|
|
||||||
// bSDLog.begin();
|
|
||||||
|
|
||||||
// Serial.begin(250000);
|
|
||||||
// if (Serial) {
|
|
||||||
// Serial.println("Start HONDA");
|
|
||||||
// }
|
|
||||||
|
|
||||||
avclan.begin();
|
avclan.begin();
|
||||||
avclanHonda.begin();
|
avclanHonda.begin();
|
||||||
|
|
||||||
EERPOM_read_config();
|
|
||||||
// bSDLog.testLog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
void loop()
|
void loop()
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( avclanHonda.bFirstStart_20 && (11500 > millis()) ) {
|
if ( avclanHonda.bFirstStart_20 && (11500 > millis()) ) {
|
||||||
HONDA_DIS_ON; // initalize
|
HONDA_DIS_ON; // initalize
|
||||||
return;
|
return;
|
||||||
|
} else if ( avclanHonda.bFirstStart_20 && !avclanHonda.isShowRearCam() && (11500 < millis()) ) {
|
||||||
|
avclanHonda.setHondaDis( false ); //Show GVN screen
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( INPUT_IS_SET ) {
|
if ( INPUT_IS_SET ) {
|
||||||
@ -58,7 +43,6 @@ void loop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( avclanHonda.isWait() ) {
|
if ( avclanHonda.isWait() ) {
|
||||||
avclanHonda.checkWait();
|
avclanHonda.checkWait();
|
||||||
if ( !avclanHonda.isWait() ) avclanHonda.tryToShowHondaDisp();
|
if ( !avclanHonda.isWait() ) avclanHonda.tryToShowHondaDisp();
|
||||||
@ -69,73 +53,6 @@ void loop()
|
|||||||
HONDA_DIS_OFF;
|
HONDA_DIS_OFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
if ( !avclanHonda.isLockTime() )
|
|
||||||
{
|
|
||||||
if ( avclanHonda.isWait() ) {
|
|
||||||
avclanHonda.checkWait();
|
|
||||||
if (avclanHonda.isWait() == false)
|
|
||||||
avclanHonda.tryToShowHondaDisp();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( INPUT_IS_SET ) {
|
|
||||||
byte res = avclan.readMessage();
|
|
||||||
if ( !res ) {
|
|
||||||
//LOG
|
|
||||||
// avclan.printMessage(true);
|
|
||||||
avclanHonda.getActionID();
|
|
||||||
if ( avclan.actionID != ACT_NONE ) {
|
|
||||||
avclanHonda.processAction( (AvcActionID)avclan.actionID );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//ON a start target
|
|
||||||
if ( 11500 > millis() ) {
|
|
||||||
HONDA_DIS_ON; // initalize
|
|
||||||
return;
|
|
||||||
} else if ( 18000 > millis() ) {
|
|
||||||
avclanHonda.falseHondaDis();
|
|
||||||
if ( !avclanHonda.isShowRearCam() ) {
|
|
||||||
HONDA_DIS_OFF;
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
HONDA_DIS_ON;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else if ( avclanHonda.getCommute() ) {
|
|
||||||
HONDA_DIS_ON;
|
|
||||||
} else {
|
|
||||||
HONDA_DIS_OFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void EERPOM_read_config()
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
if (EEPROM.read(E_INIT) != 'T')
|
|
||||||
{
|
|
||||||
EEPROM.write(E_MASTER1, 0x01);
|
|
||||||
EEPROM.write(E_MASTER2, 0x31);
|
|
||||||
EEPROM.write(E_READONLY, 0);
|
|
||||||
EEPROM.write(E_INIT, 'T');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
avclan.headAddress = (EEPROM.read(E_MASTER1) << 8) + EEPROM.read(E_MASTER2);
|
|
||||||
avclan.readonly = EEPROM.read(E_READONLY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,174 +0,0 @@
|
|||||||
#include "SD_Log.h"
|
|
||||||
#include "config.h"
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const int chipSelect = 10;
|
|
||||||
static File dataFile;
|
|
||||||
char fileName[10] = {0};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::begin()
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
// canLog = false;
|
|
||||||
bRedyToLog = false;
|
|
||||||
// // see if the card is present and can be initialized:
|
|
||||||
// if (SD.begin(chipSelect)) {
|
|
||||||
// bRedyToLog = true;
|
|
||||||
// Serial.println(" READY TO LOG ");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::testLog()
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
char filetext[40] = {0};
|
|
||||||
|
|
||||||
File dataTestFile = SD.open( "test.txt", FILE_WRITE );
|
|
||||||
if ( bRedyToLog && dataTestFile ) {
|
|
||||||
sprintf(filetext, "[%u] IEBUS HONDA V." IEBUS_VERSION, millis() );
|
|
||||||
dataTestFile.println(filetext);
|
|
||||||
openFile();
|
|
||||||
} else {
|
|
||||||
bRedyToLog = false;
|
|
||||||
}
|
|
||||||
dataTestFile.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
bool SDLog::openFile()
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
for ( int a = 1; a < 999; a++)
|
|
||||||
{
|
|
||||||
sprintf( fileName, "%d.txt", a );
|
|
||||||
if ( !SD.exists( fileName ) )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
dataFile = SD.open( fileName, FILE_WRITE );
|
|
||||||
if ( dataFile ) {
|
|
||||||
logs( String("IEBUS HONDA V.") + String(IEBUS_VERSION) );
|
|
||||||
dataFile.close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::logs(String dataString)
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
//SerialPrintLn(dataString.c_str());
|
|
||||||
dataFile = SD.open( fileName, FILE_WRITE );
|
|
||||||
if ( bRedyToLog && dataFile) {
|
|
||||||
dataFile.println(dataString);
|
|
||||||
dataFile.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::SerialPrintLn( const char *val )
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
if ( Serial ) {
|
|
||||||
Serial.println( val );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::SerialPrint( const char *val )
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
if ( Serial ) {
|
|
||||||
Serial.print( val );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::sendByte(uint8_t data)
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
if (bRedyToLog) {
|
|
||||||
dataFile.close();
|
|
||||||
dataFile = SD.open( fileName, FILE_WRITE );
|
|
||||||
dataFile.print( (char)data );
|
|
||||||
dataFile.close();
|
|
||||||
|
|
||||||
// SerialPrint(data);
|
|
||||||
/*
|
|
||||||
BASE (optional): the base sin which to print numbers:
|
|
||||||
BIN for binary (base 2),
|
|
||||||
DEC for decimal (base 10),
|
|
||||||
OCT for octal (base 8),
|
|
||||||
HEX for hexadecimal (base 16).
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::printHex4(uint8_t data)
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
uint8_t c = data & 0x0f;
|
|
||||||
c += c < 10 ? '0' : 'A' - 10 ;
|
|
||||||
sendByte(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::printHex8(uint8_t data)
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
printHex4(data >> 4);
|
|
||||||
printHex4(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::print(const char *pBuf)
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
while (*pBuf) {
|
|
||||||
sendByte(*pBuf++);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::print(const char pBuf)
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
sendByte(pBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::println(const char *pBuf)
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
print(pBuf);
|
|
||||||
println();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::println(const char pBuf)
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
print(pBuf);
|
|
||||||
println();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
void SDLog::println(void)
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
print("\n\r");
|
|
||||||
}
|
|
||||||
|
|
||||||
//void SDLog::_update()
|
|
||||||
//{
|
|
||||||
// if ( bRedyToLog ) {
|
|
||||||
// dataFile.close();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
SDLog bSDLog;
|
|
||||||
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
#ifndef SD_LOG_h
|
|
||||||
#define SD_LOG_h
|
|
||||||
|
|
||||||
#include "Arduino.h"
|
|
||||||
#include <SD.h>
|
|
||||||
#include <SPI.h>
|
|
||||||
|
|
||||||
class SDLog {
|
|
||||||
public:
|
|
||||||
void begin();
|
|
||||||
bool bRedyToLog;
|
|
||||||
void logs(String dataString);
|
|
||||||
void testLog();
|
|
||||||
|
|
||||||
void SerialPrintLn( const char *val );
|
|
||||||
void SerialPrint( const char *val );
|
|
||||||
|
|
||||||
void sendByte(uint8_t data);
|
|
||||||
void printHex4(uint8_t data);
|
|
||||||
void printHex8(uint8_t data);
|
|
||||||
|
|
||||||
void print(const char *pBuf);
|
|
||||||
void print(const char pBuf);
|
|
||||||
|
|
||||||
// print string from flash
|
|
||||||
void print_p(const char *pBuf);
|
|
||||||
void println(const char *pBuf);
|
|
||||||
void println(const char pBuf);
|
|
||||||
void println(void);
|
|
||||||
|
|
||||||
void _update();
|
|
||||||
private:
|
|
||||||
bool openFile();
|
|
||||||
// bool canLog;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern SDLog bSDLog;
|
|
||||||
|
|
||||||
#endif //#SD_LOG_h
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user