Skip to content

Commit

Permalink
Merge pull request #371 from openxc/emulatorTypeFix
Browse files Browse the repository at this point in the history
Build modifiers (emulator, obd2, etc) are now indicated in the versio…
  • Loading branch information
rwoberholzer committed Sep 16, 2016
2 parents e05bf85 + 121f96c commit bc9b22a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

* BREAKING: Removed fine_odometer_since_restart from emulator.
* Feature: Added sending evented messages from emulator.
Evented messages will come at a slower rate then other messages to simulate real world frequency
Evented messages will come at a slower rate then other messages to simulate real world frequency
* Fix: When building emualtor, obd2, or translated_obd2 firmware, those designations will now be
indicated in the version number instead of the type number in signals.cpp.
* Feature: Add support for multi-frame diagnostic responses (currently just for
receiving, not sending)
* Feature: VIs running emulator firmware will now respond to basic diagnostic requests from enabler
Expand Down
4 changes: 4 additions & 0 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def build_options():
DEFAULT_COMPILER_OPTIONS = {
'DEBUG': env.debug,
'MSD_ENABLE' : env.msd_enable,
'ENVIRONMENT_MODE' : 'default_mode',
'DEFAULT_FILE_GENERATE_SECS' : env.default_file_generate_secs,
'BOOTLOADER': env.bootloader,
'TEST_MODE_ONLY': env.test_mode_only,
Expand All @@ -151,11 +152,14 @@ def build_options():
if env.mode == 'emulator':
options['DEFAULT_EMULATED_DATA_STATUS'] = True
options['DEFAULT_POWER_MANAGEMENT'] = "ALWAYS_ON"
options['ENVIRONMENT_MODE'] = env.mode
elif env.mode == 'translated_obd2':
options['DEFAULT_POWER_MANAGEMENT'] = "OBD2_IGNITION_CHECK"
options['DEFAULT_RECURRING_OBD2_REQUESTS_STATUS'] = True
options['ENVIRONMENT_MODE'] = env.mode
elif env.mode == 'obd2':
options['DEFAULT_POWER_MANAGEMENT'] = "OBD2_IGNITION_CHECK"
options['ENVIRONMENT_MODE'] = env.mode
return " ".join((build_option(key, value)
for key, value in options.iteritems()))

Expand Down
4 changes: 4 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ SYMBOLS += DEFAULT_USB_PRODUCT_ID=$(DEFAULT_USB_PRODUCT_ID)
DEFAULT_CAN_ACK_STATUS ?= 0
SYMBOLS += DEFAULT_CAN_ACK_STATUS=$(DEFAULT_CAN_ACK_STATUS)

ENVIRONMENT_MODE ?= "default_mode"
SYMBOLS += ENVIRONMENT_MODE="\"$(ENVIRONMENT_MODE)\""

# TODO see https://github.com/openxc/vi-firmware/issues/189
# ifeq ($(NETWORK), 1)
# SYMBOLS += __USE_NETWORK__
Expand Down Expand Up @@ -213,6 +216,7 @@ endif
define show_options
$(call show_vi_config_variable,PLATFORM)
$(call show_vi_config_variable,BOOTLOADER)
$(call show_vi_config_variable,ENVIRONMENT_MODE)
$(call show_vi_config_variable,TEST_MODE_ONLY)
$(call show_vi_config_variable,DEBUG)
$(call show_vi_config_variable,MSD_ENABLE)
Expand Down
10 changes: 9 additions & 1 deletion src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ openxc::config::Configuration* openxc::config::getConfiguration() {
static openxc::config::Configuration CONFIG = {
messageSetIndex: 0,
version: "7.2.1-dev",
environmentMode: ENVIRONMENT_MODE,
payloadFormat: PayloadFormat::DEFAULT_OUTPUT_FORMAT,
recurringObd2Requests: DEFAULT_RECURRING_OBD2_REQUESTS_STATUS,
obd2BusAddress: DEFAULT_OBD2_BUS,
Expand Down Expand Up @@ -184,9 +185,16 @@ openxc::config::Configuration* openxc::config::getConfiguration() {
}

void openxc::config::getFirmwareDescriptor(char* buffer, size_t length) {
snprintf(buffer, length, "%s (%s)", getConfiguration()->version,
const char* envMode = getConfiguration()->environmentMode;
if(strcmp(envMode, "default_mode") != 0)
{
snprintf(buffer, length, "%s (%s)", getConfiguration()->version, getConfiguration()->environmentMode);
}
else {
snprintf(buffer, length, "%s (%s)", getConfiguration()->version,
signals::getActiveMessageSet() != NULL ?
signals::getActiveMessageSet()->name : "default");
}
}

#ifdef TELIT_HE910_SUPPORT
Expand Down
4 changes: 4 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ typedef enum {
* messageSetIndex - The index of the currently active message set from the
* signals module.
* version - A string describing the firmware version.
* environmentMode - A string describing the what type of firmware it is.
* Modes: default_mode, emulator, obd2, translated_obd2
* "default_mode" is when there is no modifier present (ie: emulator, obd2, etc)
* payloadFormat - The currently active payload format, from the payload module.
* This is used for both input and output.
* recurringObd2Requests - True if the VI should automatically query for
Expand Down Expand Up @@ -107,6 +110,7 @@ typedef enum {
typedef struct {
int messageSetIndex;
const char* version;
const char* environmentMode;
openxc::payload::PayloadFormat payloadFormat;
bool recurringObd2Requests;
uint8_t obd2BusAddress;
Expand Down

0 comments on commit bc9b22a

Please sign in to comment.