debug code
This commit is contained in:
parent
c9745484d2
commit
8ed8b35d77
@ -34,3 +34,10 @@ void debugWrite(uint16_t o) {
|
||||
DEBUG_OUT_REG |= DEBUG_CS;
|
||||
#endif
|
||||
}
|
||||
|
||||
void debugWrite32(uint32_t o) {
|
||||
uint16_t d1 = (uint16_t) (o & 0x0000ffff);
|
||||
uint16_t d2 = (uint16_t) ((o & 0xffff0000) >> 16);
|
||||
debugWrite(d1);
|
||||
debugWrite(d2);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
void debugInit();
|
||||
void debugWrite(uint16_t o);
|
||||
void debugWrite32(uint32_t o);
|
||||
|
||||
|
||||
#endif /* DEBUG_H_ */
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "engine.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
volatile uint32_t tickCnt = 0;
|
||||
@ -106,23 +107,11 @@ bool engineDecPwmValue() {
|
||||
return res;
|
||||
}
|
||||
|
||||
bool engineIncOffTime() {
|
||||
offTime += STEP_100ms;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool engineIncOnTime() {
|
||||
return false;
|
||||
onTime += STEP_100ms;
|
||||
}
|
||||
|
||||
bool engineDecOffTime() {
|
||||
bool res = true;
|
||||
if (offTime != 0) {
|
||||
offTime -= STEP_100ms;
|
||||
res = false;
|
||||
}
|
||||
return res;
|
||||
debugWrite(0x0001);
|
||||
debugWrite32(onTime);
|
||||
}
|
||||
|
||||
bool engineDecOnTime() {
|
||||
@ -131,9 +120,30 @@ bool engineDecOnTime() {
|
||||
onTime -= STEP_100ms;
|
||||
res = false;
|
||||
}
|
||||
debugWrite(0x0002);
|
||||
debugWrite32(onTime);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool engineIncOffTime() {
|
||||
offTime += STEP_100ms;
|
||||
debugWrite(0x0003);
|
||||
debugWrite32(offTime);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool engineDecOffTime() {
|
||||
bool res = true;
|
||||
if (offTime != 0) {
|
||||
offTime -= STEP_100ms;
|
||||
res = false;
|
||||
}
|
||||
debugWrite(0x0004);
|
||||
debugWrite32(offTime);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
uint32_t getMillis() {
|
||||
return millis;
|
||||
}
|
||||
|
22
src/hmi.cpp
22
src/hmi.cpp
@ -33,20 +33,20 @@ public:
|
||||
break;
|
||||
case STATE_BUTTON_RELEASED:
|
||||
duration = getMillis() - m_timestamp;
|
||||
{
|
||||
uint16_t d1 = (uint16_t) (duration & 0x0000ffff);
|
||||
uint16_t d2 = (uint16_t) ((duration & 0xffff0000) >> 16);
|
||||
debugWrite(d1);
|
||||
debugWrite(d2);
|
||||
}
|
||||
// {
|
||||
// uint16_t d1 = (uint16_t) (duration & 0x0000ffff);
|
||||
// uint16_t d2 = (uint16_t) ((duration & 0xffff0000) >> 16);
|
||||
// debugWrite(d1);
|
||||
// debugWrite(d2);
|
||||
// }
|
||||
if ((duration >= LOWER_SHORT_TIME) && (duration <= UPPER_SHORT_TIME)) {
|
||||
debugWrite(0x003);
|
||||
// debugWrite(0x003);
|
||||
m_state = STATE_SHORT;
|
||||
} else if (duration > UPPER_SHORT_TIME) {
|
||||
debugWrite(0x004);
|
||||
// debugWrite(0x004);
|
||||
m_state = STATE_LONG;
|
||||
} else {
|
||||
debugWrite(0x005);
|
||||
// debugWrite(0x005);
|
||||
m_state = STATE_IDLE;
|
||||
}
|
||||
break;
|
||||
@ -217,11 +217,11 @@ void hmiExec() {
|
||||
while (! ledRed.isIdle()) {
|
||||
ledRed.exec();
|
||||
}
|
||||
ledGreen.start(Led::FLASH_EXTRA_LONG);
|
||||
ledGreen.start(Led::FLASH_LONG);
|
||||
while (! ledGreen.isIdle()) {
|
||||
ledGreen.exec();
|
||||
}
|
||||
ledRed.start(Led::FLASH_EXTRA_LONG);
|
||||
ledRed.start(Led::FLASH_LONG);
|
||||
while (! ledRed.isIdle()) {
|
||||
ledRed.exec();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user