Add serial rate gauge and throughput tweaks

This commit is contained in:
Josh Stewart 2020-09-04 09:19:43 +10:00
parent b9cab787c0
commit 494d63d598
6 changed files with 21 additions and 10 deletions

View File

@ -198,13 +198,13 @@
pageChunkWrite = "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v", "w%2i%2o%2c%v"
crc32CheckCommand = "d%2i", "d%2i", "d%2i", "d%2i", "d%2i", "d%2i", "d%2i", "d%2i", "d%2i", "d%2i", "d%2i", "d%2i", "d%2i", "d%2i"
blockingFactor = 2048
blockingFactor = 64
tableBlockingFactor = 2048
delayAfterPortOpen=1000
;validateArrayBounds = true
blockReadTimeout = 2000
;tsWriteBlocks = on
interWriteDelay = 5 ;Ignored when tsWriteBlocks is on
interWriteDelay = 1 ;Ignored when tsWriteBlocks is on
pageActivationDelay = 10
restrictSquirtRelationship = false ;This requires TS 3.1 or above
@ -4444,6 +4444,7 @@ cmdVSSratio6 = "E\x99\x06"
mapMultiplyGauge = map_multiply_amt, "MAP Multiply", "%", 0, 200, 130, 140, 140, 150, 0, 0
nSquirtsGauge = nSquirts, "# Squirts", "", 0, 10, 130, 140, 140, 150, 0, 0
syncLossGauge = syncLossCounter, "# Sync Losses" "", 0, 255, -1, -1, 10, 50, 0, 0
dataRateGauge = dataRate, "Serial data rate" "reads/s", 0, 255, -1, -1, 10, 50, 0, 0
;-------------------------------------------------------------------------------
[FrontPage]
@ -4513,7 +4514,7 @@ cmdVSSratio6 = "E\x99\x06"
; you change it.
ochGetCommand = "r\$tsCanId\x30%2o%2c"
ochBlockSize = 116
ochBlockSize = 117
secl = scalar, U08, 0, "sec", 1.000, 0.000
status1 = scalar, U08, 1, "bits", 1.000, 0.000
@ -4649,6 +4650,7 @@ cmdVSSratio6 = "E\x99\x06"
fuelTempCor = scalar, U08, 113, "%", 1.000, 0.000
advance1 = scalar, U08, 114, "%", 1.000, 0.000
advance2 = scalar, U08, 115, "%", 1.000, 0.000
dataRate = scalar, U08, 116, "reads/s",1.000, 0.000
#sd_status = scalar, U08, 99, "", 1.0, 0.0
#if CELSIUS

View File

@ -41,6 +41,8 @@ uint32_t inProgressCompositeTime;
bool serialInProgress = false;
bool toothLogSendInProgress = false;
bool compositeLogSendInProgress = false;
volatile byte dataRate = 0; //The number of live data sends completed per second
volatile byte dataRateCounter = 0; //A counter for tracking the current number of live data writes that have been sent since the last second
const char pageTitles[] PROGMEM //This is being stored in the avr flash instead of SRAM which there is not very much of
{

View File

@ -630,6 +630,7 @@ void updateFullStatus()
fullStatus[113] = currentStatus.fuelTempCorrection; //Fuel temperature Correction (%)
fullStatus[114] = currentStatus.advance1; //advance 1 (%)
fullStatus[115] = currentStatus.advance2; //advance 2 (%)
fullStatus[116] = dataRate;
}
/*
This function returns the current values of a fixed group of variables
@ -658,6 +659,7 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum)
currentStatus.spark ^= (-currentStatus.hasSync ^ currentStatus.spark) & (1U << BIT_SPARK_SYNC); //Set the sync bit of the Spark variable to match the hasSync variable
updateFullStatus();
for(byte x=0; x<packetLength; x++)
{
@ -678,6 +680,7 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum)
}
serialInProgress = false;
dataRateCounter++; //Increment the data rate counter (Used for determining the current TS live data rate)
// Reset any flags that are being used to trigger page refreshes
BIT_CLEAR(currentStatus.status3, BIT_STATUS3_VSS_REFRESH);

View File

@ -9,8 +9,8 @@
#ifndef LOGGER_H
#define LOGGER_H
#define LOG_ENTRY_SIZE 116 /**< The size of the live data packet. This MUST match ochBlockSize setting in the ini file */
#define SD_LOG_ENTRY_SIZE 116 /**< The size of the live data packet used by the SD car.*/
#define LOG_ENTRY_SIZE 117 /**< The size of the live data packet. This MUST match ochBlockSize setting in the ini file */
#define SD_LOG_ENTRY_SIZE 117 /**< The size of the live data packet used by the SD car.*/
void createLog(uint8_t *array);
void createSDLog(uint8_t *array);

View File

@ -103,24 +103,23 @@ void loop()
//Initially check that the last send values request is not still outstanding
if (serialInProgress == true)
{
if(Serial.availableForWrite() > 32) { sendValues(inProgressOffset, inProgressLength, 0x30, 0); }
if(Serial.availableForWrite() > 16) { sendValues(inProgressOffset, inProgressLength, 0x30, 0); }
}
//Perform the same check for the tooth and composite logs
if( toothLogSendInProgress == true)
{
if(Serial.availableForWrite() > 32) { sendToothLog(inProgressOffset); }
if(Serial.availableForWrite() > 16) { sendToothLog(inProgressOffset); }
}
if( compositeLogSendInProgress == true)
{
if(Serial.availableForWrite() > 32) { sendCompositeLog(inProgressOffset); }
if(Serial.availableForWrite() > 16) { sendCompositeLog(inProgressOffset); }
}
//Check for any requets from serial. Serial operations are checked under 2 scenarios:
// 1) Check every 15Hz for data
// 2) If the amount of data in the serial buffer is greater than a set threhold (See globals.h). This is to avoid serial buffer overflow when large amounts of data is being sent
//Check for any in progress serial transmits that were waiting for the tx buffer to free
if ( (BIT_CHECK(TIMER_mask, BIT_TIMER_15HZ)) || (Serial.available() > SERIAL_BUFFER_THRESHOLD) )
//if ( ((mainLoopCount & 31) == 1) or (Serial.available() > SERIAL_BUFFER_THRESHOLD) )
if ( (BIT_CHECK(TIMER_mask, BIT_TIMER_30HZ)) || (Serial.available() > SERIAL_BUFFER_THRESHOLD) )
{
if (Serial.available() > 0) { command(); }
else if(cmdPending == true)

View File

@ -18,6 +18,7 @@ Timers are typically low resolution (Compared to Schedulers), with maximum frequ
#include "speeduino.h"
#include "scheduler.h"
#include "auxiliaries.h"
#include "comms.h"
#if defined(CORE_AVR)
#include <avr/wdt.h>
@ -260,6 +261,10 @@ void oneMSInterval() //Most ARM chips can simply call a function
if(BIT_CHECK(HWTest_IGN_50pc, IGN8_CMD_BIT)) { coil8Toggle(); }
}
//Reset the live data rate counter
dataRate = dataRateCounter;
dataRateCounter = 0;
}
#if defined(CORE_AVR) //AVR chips use the ISR for this
//Reset Timer2 to trigger in another ~1ms