mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-07-29 18:33:44 +02:00
Compare commits
4 Commits
v4.2.5-Dev
...
v4.2.6-Dev
Author | SHA1 | Date | |
---|---|---|---|
|
f4aa572df2 | ||
|
01e5d49332 | ||
|
6a3a891682 | ||
|
f5b48619bf |
@@ -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;
|
||||
|
@@ -1 +1 @@
|
||||
#define GITHUB_SHA "devel-202211082310Z"
|
||||
#define GITHUB_SHA "devel-202211181919Z"
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user