Commit 9e51ea06 authored by MagoKimbra's avatar MagoKimbra

bug fix

parent 48e3fab2
...@@ -744,7 +744,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -744,7 +744,7 @@ ISR(TIMER1_COMPA_vect) {
#endif #endif
#if ENABLED(STEPPER_HIGH_LOW) && STEPPER_HIGH_LOW_DELAY > 0 #if ENABLED(STEPPER_HIGH_LOW) && STEPPER_HIGH_LOW_DELAY > 0
delayMicroseconds(STEPPER_HIGH_LOW_DELAY); HAL::delayMicroseconds(STEPPER_HIGH_LOW_DELAY);
#endif #endif
#define STEP_END(axis, AXIS) \ #define STEP_END(axis, AXIS) \
...@@ -1319,7 +1319,7 @@ void quickStop() { ...@@ -1319,7 +1319,7 @@ void quickStop() {
X_STEP_WRITE(!INVERT_X_STEP_PIN); X_STEP_WRITE(!INVERT_X_STEP_PIN);
Y_STEP_WRITE(!INVERT_Y_STEP_PIN); Y_STEP_WRITE(!INVERT_Y_STEP_PIN);
Z_STEP_WRITE(!INVERT_Z_STEP_PIN); Z_STEP_WRITE(!INVERT_Z_STEP_PIN);
delayMicroseconds(2); HAL::delayMicroseconds(1U);
X_STEP_WRITE(INVERT_X_STEP_PIN); X_STEP_WRITE(INVERT_X_STEP_PIN);
Y_STEP_WRITE(INVERT_Y_STEP_PIN); Y_STEP_WRITE(INVERT_Y_STEP_PIN);
Z_STEP_WRITE(INVERT_Z_STEP_PIN); Z_STEP_WRITE(INVERT_Z_STEP_PIN);
...@@ -1345,7 +1345,7 @@ void digitalPotWrite(int address, int value) { ...@@ -1345,7 +1345,7 @@ void digitalPotWrite(int address, int value) {
SPI.transfer(address); // send in the address and value via SPI: SPI.transfer(address); // send in the address and value via SPI:
SPI.transfer(value); SPI.transfer(value);
digitalWrite(DIGIPOTSS_PIN, HIGH); // take the SS pin high to de-select the chip: digitalWrite(DIGIPOTSS_PIN, HIGH); // take the SS pin high to de-select the chip:
//delay(10); //HAL::delayMilliseconds(10);
#else #else
UNUSED(address); UNUSED(address);
UNUSED(value); UNUSED(value);
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
*/ */
#include "NexHardware.h" #include "NexHardware.h"
#define NEX_RET_CMD_FINISHED (0x01) #define NEX_RET_CMD_FINISHED (0x01)
#define NEX_RET_EVENT_LAUNCHED (0x88) #define NEX_RET_EVENT_LAUNCHED (0x88)
#define NEX_RET_EVENT_UPGRADED (0x89) #define NEX_RET_EVENT_UPGRADED (0x89)
#define NEX_RET_EVENT_TOUCH_HEAD (0x65) #define NEX_RET_EVENT_TOUCH_HEAD (0x65)
#define NEX_RET_EVENT_POSITION_HEAD (0x67) #define NEX_RET_EVENT_POSITION_HEAD (0x67)
#define NEX_RET_EVENT_SLEEP_POSITION_HEAD (0x68) #define NEX_RET_EVENT_SLEEP_POSITION_HEAD (0x68)
...@@ -24,14 +24,14 @@ ...@@ -24,14 +24,14 @@
#define NEX_RET_STRING_HEAD (0x70) #define NEX_RET_STRING_HEAD (0x70)
#define NEX_RET_NUMBER_HEAD (0x71) #define NEX_RET_NUMBER_HEAD (0x71)
#define NEX_RET_VALUE_HEAD (0x72) #define NEX_RET_VALUE_HEAD (0x72)
#define NEX_RET_INVALID_CMD (0x00) #define NEX_RET_INVALID_CMD (0x00)
#define NEX_RET_INVALID_COMPONENT_ID (0x02) #define NEX_RET_INVALID_COMPONENT_ID (0x02)
#define NEX_RET_INVALID_PAGE_ID (0x03) #define NEX_RET_INVALID_PAGE_ID (0x03)
#define NEX_RET_INVALID_PICTURE_ID (0x04) #define NEX_RET_INVALID_PICTURE_ID (0x04)
#define NEX_RET_INVALID_FONT_ID (0x05) #define NEX_RET_INVALID_FONT_ID (0x05)
#define NEX_RET_INVALID_BAUD (0x11) #define NEX_RET_INVALID_BAUD (0x11)
#define NEX_RET_INVALID_VARIABLE (0x1A) #define NEX_RET_INVALID_VARIABLE (0x1A)
#define NEX_RET_INVALID_OPERATION (0x1B) #define NEX_RET_INVALID_OPERATION (0x1B)
/* /*
* Receive uint32_t data. * Receive uint32_t data.
...@@ -236,14 +236,14 @@ bool nexInit(void) ...@@ -236,14 +236,14 @@ bool nexInit(void)
if (ret1 && ret2) { if (ret1 && ret2) {
sendCommand("baud=57600"); sendCommand("baud=57600");
nexSerial.end(); nexSerial.end();
delay(1000); HAL::delayMilliseconds(1000);
nexSerial.begin(57600); nexSerial.begin(57600);
return ret1 && ret2; return ret1 && ret2;
// Else try to 57600 baudrate // Else try to 57600 baudrate
} else { } else {
nexSerial.end(); nexSerial.end();
delay(1000); HAL::delayMilliseconds(1000);
nexSerial.begin(57600); nexSerial.begin(57600);
sendCommand(""); sendCommand("");
sendCommand("bkcmd=1"); sendCommand("bkcmd=1");
...@@ -263,7 +263,7 @@ void nexLoop(NexTouch *nex_listen_list[]) ...@@ -263,7 +263,7 @@ void nexLoop(NexTouch *nex_listen_list[])
while (nexSerial.available() > 0) while (nexSerial.available() > 0)
{ {
delay(10); HAL::delayMilliseconds(10);
c = nexSerial.read(); c = nexSerial.read();
if (NEX_RET_EVENT_TOUCH_HEAD == c) if (NEX_RET_EVENT_TOUCH_HEAD == c)
...@@ -306,7 +306,7 @@ bool sendCurrentPageId(uint8_t* pageId) ...@@ -306,7 +306,7 @@ bool sendCurrentPageId(uint8_t* pageId)
goto __return; goto __return;
} }
sendCommand("sendme"); sendCommand("sendme");
delay(50); HAL::delayMilliseconds(50);
nexSerial.setTimeout(100); nexSerial.setTimeout(100);
if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp))) if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp)))
{ {
...@@ -356,7 +356,7 @@ bool setCurrentBrightness(uint8_t dimValue) ...@@ -356,7 +356,7 @@ bool setCurrentBrightness(uint8_t dimValue)
cmd += "dim="; cmd += "dim=";
cmd += buf; cmd += buf;
sendCommand(cmd.c_str()); sendCommand(cmd.c_str());
delay(10); HAL::delayMilliseconds(10);
if(recvRetCommandFinished()) if(recvRetCommandFinished())
{ {
...@@ -391,7 +391,7 @@ bool setDefaultBaudrate(uint32_t defaultBaudrate) ...@@ -391,7 +391,7 @@ bool setDefaultBaudrate(uint32_t defaultBaudrate)
cmd += "bauds="; cmd += "bauds=";
cmd += buf; cmd += buf;
sendCommand(cmd.c_str()); sendCommand(cmd.c_str());
delay(10); HAL::delayMilliseconds(10);
if(recvRetCommandFinished()) if(recvRetCommandFinished())
{ {
......
...@@ -3094,7 +3094,7 @@ uint8_t Sd2Card::cardCommand(uint8_t cmd, uint32_t arg) { ...@@ -3094,7 +3094,7 @@ uint8_t Sd2Card::cardCommand(uint8_t cmd, uint32_t arg) {
spiSend(cmd == CMD0 ? 0X95 : 0X87); spiSend(cmd == CMD0 ? 0X95 : 0X87);
#endif // USE_SD_CRC #endif // USE_SD_CRC
// additional delay for CMD0 // additional delay for CMD0
if (cmd == CMD0) delay(100); if (cmd == CMD0) HAL::delayMilliseconds(100);
// skip stuff byte for stop read // skip stuff byte for stop read
if (cmd == CMD12) spiRec(); if (cmd == CMD12) spiRec();
...@@ -4272,28 +4272,6 @@ void SdFile::writeln_P(PGM_P str) { ...@@ -4272,28 +4272,6 @@ void SdFile::writeln_P(PGM_P str) {
// ================ SdFatUtil.cpp =================== // ================ SdFatUtil.cpp ===================
//------------------------------------------------------------------------------
/** Amount of free RAM
* \return The number of free bytes.
*/
int SdFatUtil::FreeRam() {
extern int __bss_end;
extern int* __brkval;
int free_memory;
if (reinterpret_cast<int>(__brkval) == 0) {
// if no heap use from end of bss section
free_memory = reinterpret_cast<int>(&free_memory)
- reinterpret_cast<int>(&__bss_end);
}
else {
// use from top of stack to heap
free_memory = reinterpret_cast<int>(&free_memory)
- reinterpret_cast<int>(__brkval);
}
return free_memory;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** %Print a string in flash memory to Serial. /** %Print a string in flash memory to Serial.
* *
......
...@@ -2011,7 +2011,6 @@ class SdFile : public SdBaseFile { ...@@ -2011,7 +2011,6 @@ class SdFile : public SdBaseFile {
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace SdFatUtil { namespace SdFatUtil {
int FreeRam();
void SerialPrint_P(PGM_P str); void SerialPrint_P(PGM_P str);
void SerialPrintln_P(PGM_P str); void SerialPrintln_P(PGM_P str);
} }
......
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
kill(PSTR("ERR:Please Reset")); //kill blocks //16 characters so it fits on a 16x2 display kill(PSTR("ERR:Please Reset")); //kill blocks //16 characters so it fits on a 16x2 display
while (1); //wait for user or serial reset while (1); //wait for user or serial reset
} }
#endif //WATCHDOG_RESET_MANUAL #endif // WATCHDOG_RESET_MANUAL
#endif //USE_WATCHDOG #endif // USE_WATCHDOG
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment