Commissioning tests added. E7000 tested all inputs, all outputs, I2C works. OK.
This commit is contained in:
@@ -108,7 +108,7 @@
|
||||
"PLATFORMIO=60117",
|
||||
"STM32F407xx",
|
||||
"STM32F4",
|
||||
"NOECAT",
|
||||
"ECAT",
|
||||
"STM32F4xx",
|
||||
"ARDUINO=10808",
|
||||
"ARDUINO_ARCH_STM32",
|
||||
|
||||
@@ -18,7 +18,7 @@ debug_build_flags = -O0 -g -ggdb
|
||||
monitor_port = COM19
|
||||
monitor_filters = send_on_enter, time, colorize, log2file
|
||||
monitor_speed = 115200
|
||||
build_flags = -Wl,--no-warn-rwx-segment -DNOECAT
|
||||
build_flags = -Wl,--no-warn-rwx-segment -DECAT
|
||||
lib_deps =
|
||||
SPI
|
||||
robtillaart/ADS1X15@^0.5.1
|
||||
|
||||
@@ -48,9 +48,9 @@ void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
|
||||
scale = 1.0;
|
||||
int data0 = mcp3221_0.getData();
|
||||
if ((Obj.Status = mcp3221_0.ping()) == 0)
|
||||
{ // Read good value
|
||||
{ // Read good value
|
||||
Obj.CalculatedVoltage = scale * data0 + Obj.VoltageOffset; //
|
||||
Obj.RawData = data0; // Raw voltage, read by ADC
|
||||
Obj.RawData = data0; // Raw voltage, read by ADC
|
||||
validVoltage0 = Obj.CalculatedVoltage;
|
||||
validData0 = data0;
|
||||
}
|
||||
@@ -100,24 +100,27 @@ void setup(void)
|
||||
pinMode(outputPin[i], OUTPUT);
|
||||
digitalWrite(outputPin[i], LOW);
|
||||
}
|
||||
#if 1
|
||||
// Debug leds
|
||||
pinMode(PB4, OUTPUT);
|
||||
pinMode(PB5, OUTPUT);
|
||||
pinMode(PB6, OUTPUT);
|
||||
pinMode(PB7, OUTPUT);
|
||||
digitalWrite(PB4, HIGH);
|
||||
digitalWrite(PB5, HIGH);
|
||||
digitalWrite(PB6, HIGH);
|
||||
digitalWrite(PB7, HIGH);
|
||||
digitalWrite(PB4, LOW);
|
||||
digitalWrite(PB5, LOW);
|
||||
digitalWrite(PB6, LOW);
|
||||
digitalWrite(PB7, LOW);
|
||||
digitalWrite(outputPin[0], HIGH);
|
||||
#if 0 // Uncomment for commissioning tests
|
||||
digitalWrite(outputPin[0], HIGH); // All four output leds should go high
|
||||
digitalWrite(outputPin[1], HIGH);
|
||||
digitalWrite(outputPin[2], HIGH);
|
||||
digitalWrite(outputPin[3], HIGH);
|
||||
while (1) // Apply voltage over the inputs 0-11 and see response in terminal
|
||||
{
|
||||
for (int i = 0; i < 12; i++)
|
||||
Serial1.printf("%u", digitalRead(inputPin[i]));
|
||||
Serial1.println();
|
||||
delay(100);
|
||||
}
|
||||
#endif
|
||||
|
||||
Wire2.begin();
|
||||
@@ -143,17 +146,8 @@ void loop(void)
|
||||
dTime = longTime.extendTime(micros()) - irqTime;
|
||||
if (dTime > 5000) // Not doing interrupts - handle free-run
|
||||
ecat_slv();
|
||||
#else
|
||||
|
||||
Serial1.println("\nI2C Scanner");
|
||||
Serial1.printf("Ping0=%d\n", mcp3221_0.ping());
|
||||
Serial1.printf("Ping7=%d\n", mcp3221_7.ping());
|
||||
int16_t res0 = mcp3221_0.getData();
|
||||
int16_t v0 = (res0 * 5027 * 39) / 4096;
|
||||
Serial1.printf("Voltage_0: %d Voltage_7: %d\n", v0, res0);
|
||||
delay(1000);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void sync0Handler(void)
|
||||
|
||||
Reference in New Issue
Block a user