auto-sync

This commit is contained in:
rusEfi 2017-01-04 18:02:35 -05:00
parent b1dadac2a0
commit bd4c734fd1
30 changed files with 60 additions and 71 deletions

View File

@ -292,9 +292,6 @@
#define GPS_SERIAL_DEVICE &SD1
#define GPS_SERIAL_SPEED 38400
#define CONSOLE_MODE_SWITCH_PORT GPIOB
#define CONSOLE_MODE_SWITCH_PIN 1
#define CONFIG_RESET_SWITCH_PORT GPIOD
#define CONFIG_RESET_SWITCH_PIN 6

View File

@ -129,15 +129,10 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size)
}
}
// todo: this is ugly as hell!
static char consoleInput[] = " ";
CommandHandler console_line_callback;
static bool is_serial_over_uart;
bool isSerialOverUart(void) {
return is_serial_over_uart;
return false;
}
#if (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR ) || defined(__DOXYGEN__)
@ -146,6 +141,37 @@ static SerialConfig serialConfig = { SERIAL_SPEED, 0, USART_CR2_STOP1_BITS | USA
#if EFI_PROD_CODE || EFI_EGT || defined(__DOXYGEN__)
bool consoleInBinaryMode = false;
void runConsoleLoop(ts_channel_s *console) {
if (boardConfiguration->startConsoleInBinaryMode) {
// switch to binary protocol
consoleInBinaryMode = true;
runBinaryProtocolLoop(console, true);
}
while (true) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#9e");
bool end = getConsoleLine((BaseSequentialStream*) console->channel, console->crcReadBuffer, sizeof(console->crcReadBuffer) - 3);
if (end) {
// firmware simulator is the only case when this happens
continue;
}
char *trimmed = efiTrim(console->crcReadBuffer);
(console_line_callback)(trimmed);
if (consoleInBinaryMode) {
#if EFI_SIMULATOR || defined(__DOXYGEN__)
logMsg("Switching to binary mode\r\n");
#endif
// switch to binary protocol
runBinaryProtocolLoop(console, true);
}
}
}
SerialDriver * getConsoleChannel(void) {
#if defined(EFI_CONSOLE_UART_DEVICE) || defined(__DOXYGEN__)
if (isSerialOverUart()) {
@ -169,8 +195,6 @@ bool isConsoleReady(void) {
}
#endif /* EFI_PROD_CODE || EFI_EGT */
bool consoleInBinaryMode = false;
ts_channel_s binaryConsole;
static THD_WORKING_AREA(consoleThreadStack, 3 * UTILITY_THREAD_STACK_SIZE);
@ -187,34 +211,10 @@ static THD_FUNCTION(consoleThreadThreadEntryPoint, arg) {
}
#endif /* EFI_PROD_CODE */
binaryConsole.channel = (BaseChannel *) getConsoleChannel();
runConsoleLoop(&binaryConsole);
if (boardConfiguration->startConsoleInBinaryMode) {
// switch to binary protocol
consoleInBinaryMode = true;
runBinaryProtocolLoop(&binaryConsole, true);
}
while (true) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#9e");
bool end = getConsoleLine((BaseSequentialStream*) getConsoleChannel(), consoleInput, sizeof(consoleInput));
if (end) {
// firmware simulator is the only case when this happens
continue;
}
char *trimmed = efiTrim(consoleInput);
(console_line_callback)(trimmed);
if (consoleInBinaryMode) {
#if EFI_SIMULATOR || defined(__DOXYGEN__)
logMsg("Switching to binary mode\r\n");
#endif
// switch to binary protocol
runBinaryProtocolLoop(&binaryConsole, true);
}
}
}
// 10 seconds
@ -246,10 +246,6 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p)
#if (defined(EFI_CONSOLE_UART_DEVICE) && ! EFI_SIMULATOR) || defined(__DOXYGEN__)
palSetPadMode(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN, PAL_MODE_INPUT_PULLUP);
is_serial_over_uart = GET_CONSOLE_MODE_VALUE() == EFI_USE_UART_FOR_CONSOLE;
if (isSerialOverUart()) {
/*
* Activates the serial using the driver default configuration (that's 38400)

View File

@ -17,7 +17,6 @@ typedef void (*CommandHandler)(char *);
#include "datalogging.h"
// todo: make this pin configurable
#define GET_CONSOLE_MODE_VALUE() palReadPad(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN)
#define SHOULD_INGORE_FLASH() (palReadPad(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN) == 0)
SerialDriver * getConsoleChannel(void);

View File

@ -931,9 +931,6 @@ static void printAllInfo(void) {
#if EFI_ENGINE_SNIFFER
scheduleMsg(&logger, "waveChartUsedSize=%d", waveChartUsedSize);
#endif
#if EFI_PROD_CODE
scheduleMsg(&logger, "console mode jumper: %s", boolToString(!GET_CONSOLE_MODE_VALUE()));
#endif
}
static void getValue(const char *paramStr) {

View File

@ -4,7 +4,7 @@ import static com.rusefi.AutoTest.*;
/**
* this test connects to real hardware via serial port
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 2/22/2015
*/
public class RealHwTest {

View File

@ -3,7 +3,7 @@ package com.rusefi.autotune;
import java.util.Collection;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 2/18/2016.
*/
public interface FuelAutoLogic {

View File

@ -6,7 +6,7 @@ import java.util.Collection;
/**
* 1/5/2016
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
*/
public enum FuelAutoTune implements FuelAutoLogic {
INSTANCE;

View File

@ -5,7 +5,7 @@ import com.rusefi.config.Fields;
import java.util.Collection;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 2/18/2016.
*/
public enum FuelAutoTune2 implements FuelAutoLogic {

View File

@ -1,7 +1,7 @@
package com.rusefi.autotune;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 2/18/2016.
*/
public class MathUtil {

View File

@ -1,7 +1,7 @@
package com.rusefi.autotune;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 2/23/2016.
*/
public class Result {

View File

@ -3,7 +3,7 @@ package com.rusefi.autotune;
import com.rusefi.config.Fields;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 2/23/2016.
*/
public class stDataOnline {

View File

@ -13,7 +13,7 @@ import static com.rusefi.autotune.test.FuelAutoTuneTest.createVeTable;
/**
* 2/23/2016
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
*/
public class FuelAutoTune2Test {

View File

@ -11,7 +11,7 @@ import java.util.List;
/**
* 1/5/2016
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
*/
public class FuelAutoTuneTest {

View File

@ -1,7 +1,7 @@
package com.rusefi;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 2/22/2015
*/
public class CmdLine {

View File

@ -32,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* <p/>
* <p/>
* 12/25/12
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
*
* @see StartupFrame
* @see EngineSnifferPanel

View File

@ -14,7 +14,7 @@ import java.io.File;
import static com.romraider.editor.ecu.ECUEditorManager.getECUEditor;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 3/6/2015
*/
public class RomRaiderWrapper {

View File

@ -8,7 +8,7 @@ import java.io.IOException;
import java.io.Writer;
/**
* (c) Andrey Belomutskiy
* (c) Andrey Belomutskiy 2013-2017
* 4/15/2016.
*/
public class SensorLogger {

View File

@ -20,7 +20,7 @@ import java.util.List;
/**
* Date: 12/21/13
* Andrey Belomutskiy (c) 2012-2013
* (c) Andrey Belomutskiy 2013-2017
*/
public class SensorSnifferPane {
private static final String HELP_URL = "http://rusefi.com/wiki/index.php?title=Manual:DevConsole#Analog_Chart";

View File

@ -38,7 +38,7 @@ public class StartupFrame {
// todo: figure out a better way to work with absolute path
private static final String APPICON = "appicon.png";
private static final String LOGO = "logo.gif";
private static final String LINK_TEXT = "rusEfi (c) 2012-2016";
private static final String LINK_TEXT = "rusEfi (c) 2012-2017";
private static final String URI = "http://rusefi.com/?java_console";
private static final String VCP_DRIVER_TEXT = "vcp driver";
private static final String VCP_DRIVER_URI = "http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/driver/stsw-stm32102.zip";

View File

@ -19,7 +19,7 @@ import java.util.List;
* This utility produces images of trigger signals supported by rusEfi
*
* 06/23/15
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
*/
public class TriggerImage {
private static final String TRIGGERTYPE = "TRIGGERTYPE";

View File

@ -18,7 +18,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 3/7/2015
*/
public class UploadChanges {

View File

@ -4,7 +4,7 @@ import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
*/
public class EraseChip extends ProcessStatusWindow {
private final JButton button = new JButton("Erase Chip");

View File

@ -6,7 +6,7 @@ import java.awt.event.ActionListener;
import java.io.*;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 2/4/15
*/
public class FirmwareFlasher extends ProcessStatusWindow {

View File

@ -8,7 +8,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
*/
public class ProcessStatusWindow {
public static boolean isWindows() {

View File

@ -20,7 +20,7 @@ import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
*/
public class FormulasPane {
private final JPanel content = new JPanel(new BorderLayout());

View File

@ -30,7 +30,7 @@ import java.util.Date;
import java.util.List;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 1/9/2016
*
* @see FuelAutoTune

View File

@ -9,7 +9,7 @@ import javax.swing.*;
import java.awt.*;
/**
* (c) Andrey Belomutskiy 2013-2016
* (c) Andrey Belomutskiy 2013-2017
* 3/7/2015
*/
public class StatusWindow {

View File

@ -30,7 +30,7 @@ import java.util.List;
* <p/>
* <p/>
* Date: 6/23/13
* Andrey Belomutskiy (c) 2012-2013
* (c) Andrey Belomutskiy 2013-2017
*
* @see EngineSnifferStatusPanel status bar
* @see com.rusefi.ui.test.WavePanelSandbox

View File

@ -16,7 +16,7 @@ import java.util.Map;
* <p/>
* <p/>
* Date: 12/26/13
* Andrey Belomutskiy (c) 2012-2013
* (c) Andrey Belomutskiy 2013-2017
*/
public class EngineSnifferStatusPanel {
public final JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));

View File

@ -11,7 +11,7 @@ import java.awt.event.KeyEvent;
/**
* 7/7/13
* (c) Andrey Belomutskiy
* (c) Andrey Belomutskiy 2013-2017
*/
class ZoomControl extends JPanel {
// private final JLabel currentValue = new JLabel();