parent
b3eb8a6e44
commit
dfaac25df1
|
@ -49,7 +49,7 @@ struct TunerStudioOutputChannels {
|
|||
* Yes, I do not really enjoy packing bits into integers but we simply have too many boolean flags and I cannot
|
||||
* water 4 bytes per traffic - I want gauges to work as fast as possible
|
||||
*/
|
||||
unsigned int hasSdCard : 1; // bit 0, 72
|
||||
unsigned int sd_present : 1; // bit 0, 72
|
||||
unsigned int isIgnitionEnabledIndicator : 1; // bit 1
|
||||
unsigned int isInjectionEnabledIndicator : 1; // bit 2
|
||||
unsigned int unusedb3 : 1; // bit 3
|
||||
|
@ -237,7 +237,9 @@ struct TunerStudioOutputChannels {
|
|||
|
||||
int16_t tuneCrc16; // 244
|
||||
|
||||
uint8_t sd_status; // 246
|
||||
// Offset 246: bits
|
||||
uint8_t sd_logging_internal : 1; // bit 0
|
||||
uint8_t sd_msd : 1; // bit 1
|
||||
|
||||
int8_t tcuCurrentGear; // 247
|
||||
|
||||
|
|
|
@ -480,10 +480,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
executorStatistics();
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
#if EFI_SIMULATOR
|
||||
tsOutputChannels->sd_status = 1 + 4;
|
||||
#endif
|
||||
|
||||
// header
|
||||
tsOutputChannels->tsConfigVersion = TS_FILE_VERSION;
|
||||
|
||||
|
@ -693,10 +689,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
tsOutputChannels->needBurn = getNeedToWriteConfiguration();
|
||||
#endif /* EFI_INTERNAL_FLASH */
|
||||
|
||||
#if EFI_FILE_LOGGING
|
||||
tsOutputChannels->hasSdCard = isSdCardAlive();
|
||||
#endif /* EFI_FILE_LOGGING */
|
||||
|
||||
tsOutputChannels->isFuelPumpOn = enginePins.fuelPumpRelay.getLogicValue();
|
||||
tsOutputChannels->isFanOn = enginePins.fanRelay.getLogicValue();
|
||||
tsOutputChannels->isO2HeaterOn = enginePins.o2heater.getLogicValue();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "mass_storage_init.h"
|
||||
#include "mass_storage_device.h"
|
||||
#include "null_device.h"
|
||||
#include "tunerstudio_outputs.h"
|
||||
|
||||
#if HAL_USE_USB_MSD
|
||||
|
||||
|
@ -66,6 +67,11 @@ static const scsi_inquiry_response_t sdCardInquiry = {
|
|||
|
||||
void attachMsdSdCard(BaseBlockDevice* blkdev) {
|
||||
msd.attachLun(1, blkdev, blkbuf1, &sdCardInquiry, nullptr);
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
// SD MSD attached, enable indicator in TS
|
||||
tsOutputChannels.sd_msd = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static BaseBlockDevice* getRamdiskDevice() {
|
||||
|
|
|
@ -394,6 +394,11 @@ static BaseBlockDevice* initializeMmcBlockDevice() {
|
|||
static bool mountMmc() {
|
||||
auto cardBlockDevice = initializeMmcBlockDevice();
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
// If not null, card is present
|
||||
tsOutputChannels.sd_present = cardBlockDevice != nullptr;
|
||||
#endif
|
||||
|
||||
#if HAL_USE_USB_MSD
|
||||
// Wait for the USB stack to wake up, or a 5 second timeout, whichever occurs first
|
||||
msg_t usbResult = usbConnectedSemaphore.wait(TIME_MS2I(5000));
|
||||
|
@ -480,6 +485,10 @@ static THD_FUNCTION(MMCmonThread, arg) {
|
|||
return;
|
||||
}
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
tsOutputChannels.sd_logging_internal = true;
|
||||
#endif
|
||||
|
||||
while (true) {
|
||||
// if the SPI device got un-picked somehow, cancel SD card
|
||||
if (CONFIG(sdCardSpiDevice) == SPI_NONE) {
|
||||
|
|
|
@ -177,7 +177,7 @@ enable2ndByteCanID = false
|
|||
;
|
||||
|
||||
; Bit flags
|
||||
hasSdCard = bits, U32, 0, [0:0], "true", "false";
|
||||
sd_present = bits, U32, 0, [0:0], "true", "false";
|
||||
isIgnitionEnabledIndicator=bits,U32, 0, [1:1], "true", "false";
|
||||
isInjectionEnabledIndicator=bits,U32,0, [2:2], "true", "false";
|
||||
isCylinderCleanupActivated=bits,U32, 0, [4:4], "true", "false";
|
||||
|
@ -365,7 +365,8 @@ enable2ndByteCanID = false
|
|||
|
||||
; we use this to match logs to tunes
|
||||
tuneCrc16 = scalar, U16, 244, "crc16", 1, 0
|
||||
sd_status = scalar, U08, 246, "", 1.0, 0.0
|
||||
sd_logging_internal = bits, U08, 246, [0:0], "true", "false"
|
||||
sd_msd = bits, U08, 246, [1:1], "true", "false"
|
||||
|
||||
; Transmission
|
||||
tcuCurrentGear = scalar, S08, 247, "gear", 1, 0
|
||||
|
@ -1219,14 +1220,9 @@ gaugeCategory = DynoView
|
|||
indicator = { knockEverIndicator }, "", "Knock recently", white, black, red, black
|
||||
indicator = { knockNowIndicator }, "no knock", "Knock NOW", white, black, red, black
|
||||
|
||||
; this bit array has special meaning for TS - that's part of TS build in file transfer
|
||||
; we _probably_ should officially retire TS file transfer since we have something way cooler!
|
||||
indicator = { sd_status & 1}, "No SD", "SD in", white, black, green, black
|
||||
indicator = { sd_status & 4}, "SD ready", "SD ready", white, black, green, black
|
||||
indicator = { sd_status & 8}, "SD Log", "SD Log", white, black, green, black
|
||||
indicator = { sd_status & 16}, "SD Err", "SD Err", white, black, red, black
|
||||
; todo: duplication with 'SD in'?!
|
||||
indicator = { hasSdCard}, "no SD", "with SD", white, black, green, black
|
||||
indicator = { sd_present }, "no SD card", "SD card OK", white, black, green, black
|
||||
indicator = { sd_logging_internal }, "SD logging", "SD logging", white, black, green, black
|
||||
indicator = { sd_msd }, "SD USB", "SD USB", white, black, green, black
|
||||
|
||||
; looks like TS would append four system indicators below: Data Logging, ???, Not Connected, Protocol Error
|
||||
|
||||
|
|
Loading…
Reference in New Issue