1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-29 18:33:44 +02:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Harald Barth
f4aa572df2 Remove RAM thief 2022-11-18 20:19:53 +01:00
Harald Barth
01e5d49332 version 2022-11-16 00:14:54 +01:00
Harald Barth
6a3a891682 break to va_end() 2022-11-16 00:14:11 +01:00
Harald Barth
f5b48619bf AVR Mega2560: Set timer reg ADCSRB correct 2022-11-16 00:13:31 +01:00
5 changed files with 23 additions and 9 deletions

View File

@@ -126,6 +126,7 @@ void DCCTimer::reset() {
#endif
uint16_t ADCee::usedpins = 0;
int * ADCee::analogvals = NULL;
bool ADCusesHighPort = false;
/*
* Register a new pin to be scanned
@@ -136,6 +137,8 @@ int ADCee::init(uint8_t pin) {
uint8_t id = pin - A0;
if (id > NUM_ADC_INPUTS)
return -1023;
if (id > 7)
ADCusesHighPort = true;
pinMode(pin, INPUT);
int value = analogRead(pin);
if (analogvals == NULL)
@@ -196,7 +199,15 @@ void ADCee::scan() {
while (true) {
if (mask & usedpins) {
// start new ADC aquire on id
ADMUX=(1<<REFS0)|id; //select AVCC as reference and set MUX
#if defined(ADCSRB) && defined(MUX5)
if (ADCusesHighPort) { // if we ever have started to use high pins)
if (id > 7) // if we use a high ADC pin
bitSet(ADCSRB, MUX5); // set MUX5 bit
else
bitClear(ADCSRB, MUX5);
}
#endif
ADMUX=(1<<REFS0)|(id & 0x07); //select AVCC as reference and set MUX
bitSet(ADCSRA,ADSC); // start conversion
// for scope debug TrackManager::track[1]->setBrake(1);
waiting = true;

View File

@@ -1 +1 @@
#define GITHUB_SHA "devel-202211082310Z"
#define GITHUB_SHA "devel-202211181919Z"

View File

@@ -189,11 +189,12 @@ bool RingStream::commit() {
_mark++;
if (_mark==_len) _mark=0;
_buffer[_mark]=lowByte(_count);
{ char s[_count+2];
strncpy(s, (const char*)&(_buffer[_mark+1]), _count);
s[_count]=0;
//DIAG(F("RS commit count=%d core %d \"%s\""), _count, xPortGetCoreID(), s);
}
// Enable this for debugging only, it requires A LOT of RAM
//{ char s[_count+2];
// strncpy(s, (const char*)&(_buffer[_mark+1]), _count);
// s[_count]=0;
// DIAG(F("RS commit count=%d core %d \"%s\""), _count, xPortGetCoreID(), s);
//}
_ringClient = NO_CLIENT;
return true; // commit worked
}

View File

@@ -70,7 +70,7 @@ void StringFormatter::send2(Print * stream,const FSH* format, va_list args) {
char* flash=(char*)format;
for(int i=0; ; ++i) {
char c=GETFLASH(flash+i);
if (c=='\0') return;
if (c=='\0') break; // to va_end()
if(c!='%') { stream->print(c); continue; }
bool formatContinues=false;

View File

@@ -4,7 +4,9 @@
#include "StringFormatter.h"
#define VERSION "4.2.5"
#define VERSION "4.2.6"
// 4.2.6 FIX: Remove RAM thief
// FIX: ADC port 8-15 fix
// 4.2.5 Make GETFLASHW code more universal
// FIX: Withrottle roster index
// Ethernet start improvement and link detection