1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 08:36:14 +01:00

using a bunch of memory?

This commit is contained in:
travis-farmer 2023-10-21 15:57:50 -04:00
parent f88c617dbe
commit 1745fa72db

View File

@ -210,23 +210,23 @@ void DCCTimer_Handler() {
void DCCTimer::begin(INTERRUPT_CALLBACK callback) { void DCCTimer::begin(INTERRUPT_CALLBACK callback) {
interruptHandler=callback; interruptHandler=callback;
noInterrupts(); noInterrupts();
// adc_set_sample_rate(ADC_SAMPLETIME_480CYCLES); // adc_set_sample_rate(ADC_SAMPLETIME_480CYCLES);
timer.pause(); timer.pause();
timerAux.pause(); timerAux.pause();
timer.setPrescaleFactor(1); timer.setPrescaleFactor(1);
timer.setOverflow(DCC_SIGNAL_TIME, MICROSEC_FORMAT); timer.setOverflow(DCC_SIGNAL_TIME, MICROSEC_FORMAT);
timer.attachInterrupt(DCCTimer_Handler); timer.attachInterrupt(DCCTimer_Handler);
timer.refresh(); timer.refresh();
timerAux.setPrescaleFactor(1); timerAux.setPrescaleFactor(1);
timerAux.setOverflow(DCC_SIGNAL_TIME, MICROSEC_FORMAT); timerAux.setOverflow(DCC_SIGNAL_TIME, MICROSEC_FORMAT);
timerAux.refresh(); timerAux.refresh();
timer.resume();
timerAux.resume();
interrupts(); timer.resume();
timerAux.resume();
interrupts();
} }
bool DCCTimer::isPWMPin(byte pin) { bool DCCTimer::isPWMPin(byte pin) {
@ -295,10 +295,13 @@ int DCCTimer::getMinimumFreeMemory() {
interrupts(); interrupts();
return retval; return retval;
} }
extern "C" char* sbrk(int incr);
int DCCTimer::freeMemory() { int DCCTimer::freeMemory() {
char top; char top;
return (int)(1024000);
return (int)(&top - reinterpret_cast<char*>(sbrk(0)));
} }
void DCCTimer::reset() { void DCCTimer::reset() {