Merge remote-tracking branch 'origin/master' into fresh_chibios_2nd

This commit is contained in:
rusefi 2017-04-05 20:55:53 -04:00
commit 9a7aa62cde
14 changed files with 58 additions and 13 deletions

View File

@ -256,7 +256,7 @@ static void printSensors(Logging *log, bool fileFormat) {
reportSensorF(log, fileFormat, "ENGINE_LOAD", "x", engineLoad, 2);
reportSensorF(log, fileFormat, "dwell", "ms", ENGINE(engineState.sparkDwell), 2);
reportSensorF(log, fileFormat, GAUGE_COIL_DWELL_TIME, "ms", ENGINE(engineState.sparkDwell), 2);
if (fileFormat) {
reportSensorF(log, fileFormat, "timing", "deg", engine->engineState.timingAdvance, 2);

View File

@ -181,7 +181,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
efitick_t nowNt = getTimeNowNt();
engine->m.beforeRpmCb = GET_TIMESTAMP();
#if EFI_PROD_CODE
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "lowstck#2z");
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "lowstckRCL");
#endif
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)

View File

@ -14,6 +14,6 @@ if not exist openocd/openocd.exe echo openocd/openocd.exe NOT FOUND
if not exist openocd/openocd.exe exit -1
openocd\openocd.exe -f openocd/stm32f429disc1.cfg -c init -c targets -c "halt" -c "flash erase_address 0x08000000 0x080000" -c shutdown
openocd\openocd.exe -f openocd/stm32f429disc1.cfg -c init -c targets -c "halt" -c "flash erase_address 0x08000000 0x0100000" -c shutdown
rem openocd-0.8.0.exe -f interface/stlink-v2.cfg -f board/stm32f4discovery.cfg -c init -c targets -c "halt" -c "flash erase_address 0x08000000 0x080000" -c shutdown

View File

@ -180,6 +180,8 @@ digital_input_s * initWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin)
ICUDriver *driver = getInputCaptureDriver(msg, brainPin);
digital_input_s *hw = registeredIcus.add();
hw->widthListeners.clear();
hw->periodListeners.clear();
hw->brainPin = brainPin;
hw->driver = driver;
turnOnCapturePin(msg, brainPin);

View File

@ -231,6 +231,7 @@ void applyNewHardwareSettings(void) {
stopIgnitionPins();
stopCanPins();
stopETBPins();
stopVSSPins();
if (engineConfiguration->bc.is_enabled_spi_1 != activeConfiguration.bc.is_enabled_spi_1)
stopSpi(SPI_DEVICE_1);
@ -288,6 +289,7 @@ void applyNewHardwareSettings(void) {
startIgnitionPins();
startCanPins();
startETBPins();
startVSSPins();
adcConfigListener(engine);
}

View File

@ -66,6 +66,15 @@ bool hasVehicleSpeedSensor() {
return boardConfiguration->vehicleSpeedSensorInputPin != GPIO_UNASSIGNED;
}
void stopVSSPins(void) {
unmarkPin(activeConfiguration.bc.vehicleSpeedSensorInputPin);
// todo: remove driver from registeredIcus
}
void startVSSPins(void) {
// todo
}
void initVehicleSpeed(Logging *l) {
logger = l;
addConsoleAction("speedinfo", speedInfo);

View File

@ -17,5 +17,7 @@ float getVehicleSpeed(void);
void initVehicleSpeed(Logging *logger);
void setMockVehicleSpeed(float speedKPH);
bool hasVehicleSpeedSensor();
void stopVSSPins(void);
void startVSSPins(void);
#endif /* HW_LAYER_VEHICLE_SPEED_H_ */

View File

@ -24,6 +24,7 @@ template<int MAX_INT_LISTENER_COUNT>
class IntListenerArray {
public:
IntListenerArray();
void clear();
void registerCallback(VoidInt handler, void *arg);
void registerCallback(Void listener);
void invokeJustArgCallbacks();
@ -52,6 +53,11 @@ public:
template<int MAX_INT_LISTENER_COUNT>
IntListenerArray<MAX_INT_LISTENER_COUNT>::IntListenerArray() {
clear();
}
template<int MAX_INT_LISTENER_COUNT>
void IntListenerArray<MAX_INT_LISTENER_COUNT>::clear() {
currentListenersCount = 0;
memset(&args, 0, sizeof(args));
memset(&callbacks, 0, sizeof(callbacks));

View File

@ -1,14 +1,15 @@
package com.rusefi;
import com.rusefi.core.MessagesCentral;
import com.rusefi.core.Sensor;
import com.rusefi.core.SensorCentral;
import com.rusefi.io.CommandQueue;
import com.rusefi.io.ConnectionStatus;
import com.rusefi.waves.EngineChart;
import com.rusefi.waves.EngineReport;
import static com.rusefi.IoUtil.changeRpm;
import static com.rusefi.TestingUtils.nextChart;
import static com.rusefi.IoUtil.sendCommand;
import static com.rusefi.IoUtil.sleep;
import static com.rusefi.TestingUtils.*;
import static com.rusefi.waves.EngineReport.isCloseEnough;
@ -24,8 +25,17 @@ import static com.rusefi.waves.EngineReport.isCloseEnough;
public class AutoTest {
public static final int COMPLEX_COMMAND_RETRY = 10000;
static int currentEngineType;
private static String fatalError;
static void mainTestBody() {
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
@Override
public void onMessage(Class clazz, String message) {
if (message.startsWith(ConnectionStatus.FATAL_MESSAGE_PREFIX))
fatalError = message;
}
});
sendCommand("fl 1"); // just in case it was disabled
testCustomEngine();
testMazdaMiata2003();
@ -410,6 +420,15 @@ public class AutoTest {
assertWaveNull("hard limit check", chart, EngineChart.INJECTOR_1);
}
private static void sendCommand(String command) {
sendCommand(command, CommandQueue.DEFAULT_TIMEOUT, Timeouts.CMD_TIMEOUT);
}
private static void sendCommand(String command, int retryTimeoutMs, int totalTimeoutSeconds) {
assertNull("Fatal not expected", fatalError);
IoUtil.sendCommand(command, retryTimeoutMs, totalTimeoutSeconds);
}
private static void assertEquals(double expected, double actual) {
assertEquals("", expected, actual);
}

View File

@ -18,7 +18,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/
public class ConnectionStatus {
// todo: react to any message as connected? how to know if message from controller, not internal message?
private static final String FATAL_MESSAGE_PREFIX = "FATAL";
public static final String FATAL_MESSAGE_PREFIX = "FATAL";
@NotNull
private Value value = Value.NOT_CONNECTED;

View File

@ -44,12 +44,11 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20170314;
public static final int CONSOLE_VERSION = 20170324;
public static final boolean SHOW_STIMULATOR = false;
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";
protected static final String SPEED_KEY = "speed";
public static final String FATAL_ERROR_PREFIX = "FATAL";
private final String port;
// todo: the logic around 'fatalError' could be implemented nicer
private String fatalError;
@ -131,7 +130,7 @@ public class Launcher {
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
@Override
public void onMessage(Class clazz, String message) {
if (message.startsWith(FATAL_ERROR_PREFIX))
if (message.startsWith(ConnectionStatus.FATAL_MESSAGE_PREFIX))
fatalError = message;
}
});

View File

@ -9,8 +9,9 @@ import java.awt.event.ActionEvent;
public class EraseChip extends ProcessStatusWindow {
private final JButton button = new JButton("Erase Chip");
private static final String FLASH_SIZE = "0x0100000";
private static final String OPEN_OCD_COMMAND = FirmwareFlasher.OPENOCD_CMD +
" -c init -c targets -c \"halt\" -c \"flash erase_address 0x08000000 0x080000\" -c shutdown";
" -c init -c targets -c \"halt\" -c \"flash erase_address 0x08000000 " + FLASH_SIZE + "\" -c shutdown";
public EraseChip() {
button.addActionListener(new AbstractAction() {

View File

@ -1,8 +1,8 @@
package com.rusefi.ui;
import com.rusefi.FileLog;
import com.rusefi.Launcher;
import com.rusefi.core.MessagesCentral;
import com.rusefi.io.ConnectionStatus;
import com.rusefi.ui.util.UiUtils;
import javax.swing.*;
@ -50,7 +50,7 @@ public class WarningPanel {
if (haveFatalError)
return;
if (message.startsWith(Launcher.FATAL_ERROR_PREFIX)) {
if (message.startsWith(ConnectionStatus.FATAL_MESSAGE_PREFIX)) {
haveFatalError = true;
fatalBlinking.start();
label.setText(message);

View File

@ -19,7 +19,12 @@ cd ..
cd firmware
echo %date% %time%
echo "CD to ${PWD}"
echo Erasing chip
call flash_erase
echo Building firmware
rm -fR .dep
rm -fR build