Skip to content

Commit

Permalink
Merge pull request #7 from openvehicles/master
Browse files Browse the repository at this point in the history
Update 09.02.
  • Loading branch information
martingraml committed Feb 9, 2019
2 parents 1e92e25 + 28b3881 commit 2666202
Show file tree
Hide file tree
Showing 41 changed files with 847 additions and 280 deletions.
16 changes: 8 additions & 8 deletions vehicle/OVMS.V3/components/console_ssh/src/console_ssh.cpp
Expand Up @@ -1094,27 +1094,27 @@ void RSAKeyGenerator::Service()
byte digest[SHA256_DIGEST_SIZE];
Sha256 sha;
const char* type = "ssh-rsa";
byte length[8];
uint32_t length[2];
byte exp[8];
byte mod[260];
uint32_t explen = sizeof(exp);
uint32_t modlen = sizeof(mod);
ret = wc_RsaFlattenPublicKey(&key, exp, &explen, mod, &modlen);
wc_InitSha256(&sha);
*(uint32_t*)length = htonl(strlen(type));
wc_Sha256Update(&sha, length, sizeof(uint32_t));
length[0] = htonl(strlen(type));
wc_Sha256Update(&sha, (byte*)length, sizeof(uint32_t));
wc_Sha256Update(&sha, (const byte*)type, 7);
*(uint32_t*)length = htonl(explen);
wc_Sha256Update(&sha, length, sizeof(uint32_t));
length[0] = htonl(explen);
wc_Sha256Update(&sha, (byte*)length, sizeof(uint32_t));
wc_Sha256Update(&sha, exp, explen);
int extra = 0;
if (mod[0] & 0x80) // DER encoding inserts 0x00 byte if first data bit is 1
{
++extra;
length[sizeof(uint32_t)] = 0x00;
length[1] = 0;
}
*(uint32_t*)length = htonl(modlen+extra);
wc_Sha256Update(&sha, length, sizeof(uint32_t)+extra);
length[0] = htonl(modlen+extra);
wc_Sha256Update(&sha, (byte*)length, sizeof(uint32_t)+extra);
wc_Sha256Update(&sha, mod, modlen);
wc_Sha256Final(&sha, digest);
unsigned char fp[48];
Expand Down
8 changes: 5 additions & 3 deletions vehicle/OVMS.V3/components/dbc/src/dbc.cpp
Expand Up @@ -711,13 +711,15 @@ const std::string& dbcSignal::GetName()
void dbcSignal::SetName(const std::string& name)
{
m_name = name;
m_metric = MyMetrics.Find(name.c_str());

std::string mappedname(name);
std::replace( mappedname.begin(), mappedname.end(), '_', '.');
m_metric = MyMetrics.Find(mappedname.c_str());
}

void dbcSignal::SetName(const char* name)
{
m_name = std::string(name);
m_metric = MyMetrics.Find(name);
SetName(std::string(name));
}

bool dbcSignal::IsMultiplexor()
Expand Down
8 changes: 4 additions & 4 deletions vehicle/OVMS.V3/components/microrl/microrl.c
Expand Up @@ -377,11 +377,12 @@ static void terminal_print_line (microrl_t * pThis, int pos, int reset)
}

//*****************************************************************************
void microrl_init (microrl_t * pThis, void (*print) (microrl_t*, const char *))
void microrl_init (microrl_t * pThis, void (*print) (microrl_t*, const char *), void (*error_print) (microrl_t*, const char *))
{
memset(pThis, 0, sizeof(microrl_t));
pThis->prompt_str = prompt_default;
pThis->print = print;
pThis->error_print = error_print;
#ifdef _ENABLE_INIT_PROMPT
print_prompt (pThis);
#endif
Expand Down Expand Up @@ -628,11 +629,10 @@ void new_line_handler(microrl_t * pThis){
if (status == -1){
// pThis->print ("ERROR: Max token amount exseed\n");
#ifdef _USE_QUOTING
pThis->print (pThis, "ERROR:too many tokens or invalid quoting");
pThis->error_print (pThis, "ERROR:too many tokens or invalid quoting" ENDL);
#else
pThis->print (pThis, "ERROR:too many tokens");
pThis->error_print (pThis, "ERROR:too many tokens" ENDL);
#endif
pThis->print (pThis, ENDL);
}
if ((status > 0) && (pThis->execute != NULL))
pThis->execute (pThis, status, tkn_arr);
Expand Down
3 changes: 2 additions & 1 deletion vehicle/OVMS.V3/components/microrl/microrl.h
Expand Up @@ -99,14 +99,15 @@ struct microrl {
int (*execute) (microrl_t* pThis, int argc, const char * const * argv ); // ptr to 'execute' callback
char ** (*get_completion) (microrl_t* pThis, int argc, const char * const * argv ); // ptr to 'completion' callback
void (*print) (microrl_t* pThis, const char *); // ptr to 'print' callback
void (*error_print) (microrl_t* pThis, const char *); // ptr to 'print' callback for error msg
#ifdef _USE_CTLR_C
void (*sigint) (microrl_t* pThis);
#endif
void* userdata; // Generic user data storage
};

// init internal data, calls once at start up
void microrl_init (microrl_t * pThis, void (*print)(microrl_t* pThis, const char*));
void microrl_init (microrl_t * pThis, void (*print)(microrl_t* pThis, const char*), void (*error_print)(microrl_t* pThis, const char*));

// set echo mode (true/false), using for disabling echo for password input
// echo mode will enabled after user press Enter.
Expand Down
4 changes: 2 additions & 2 deletions vehicle/OVMS.V3/components/ovms_webserver/assets/ovms.js
Expand Up @@ -139,7 +139,7 @@ function setcontent(tgt, uri, text){
var mi = $("#nav [href='"+uri+"']");
mi.parents("li").addClass("active");
tgt[0].scrollIntoView();
tgt.html(text).hide().fadeIn(50);
tgt.html(text);
var $p = tgt.find(">.panel");
if ($p.length == 1) $p.addClass("panel-single");
if (mi.length > 0)
Expand All @@ -148,7 +148,7 @@ function setcontent(tgt, uri, text){
document.title = "OVMS Console";
} else {
tgt[0].scrollIntoView();
tgt.html(text).hide().fadeIn(50);
tgt.html(text);
}

tgt.find(".get-window-resize").trigger('window-resize');
Expand Down
Binary file modified vehicle/OVMS.V3/components/ovms_webserver/assets/script.js.gz
Binary file not shown.
8 changes: 4 additions & 4 deletions vehicle/OVMS.V3/components/simcom/src/simcom.cpp
Expand Up @@ -46,7 +46,7 @@ const char* SimcomState1Name(simcom::SimcomState1 state)
case simcom::None: return "None";
case simcom::CheckPowerOff: return "CheckPowerOff";
case simcom::PoweringOn: return "PoweringOn";
case simcom::PoweredOn: return "PoweredOff";
case simcom::PoweredOn: return "PoweredOn";
case simcom::MuxStart: return "MuxStart";
case simcom::NetWait: return "NetWait";
case simcom::NetStart: return "NetStart";
Expand Down Expand Up @@ -1081,8 +1081,8 @@ void simcom_setstate(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int ar
newstate = simcom::CheckPowerOff;
else if (strcmp(statename,"PoweringOn")==0)
newstate = simcom::PoweringOn;
else if (strcmp(statename,"PoweredOff")==0)
newstate = simcom::PoweredOff;
else if (strcmp(statename,"PoweredOn")==0)
newstate = simcom::PoweredOn;
else if (strcmp(statename,"MuxStart")==0)
newstate = simcom::MuxStart;
else if (strcmp(statename,"NetWait")==0)
Expand Down Expand Up @@ -1127,7 +1127,7 @@ SimcomInit::SimcomInit()
OvmsCommand* cmd_simcom = MyCommandApp.RegisterCommand("simcom","SIMCOM framework",simcom_status, "", 0, 1);
cmd_simcom->RegisterCommand("tx","Transmit data on SIMCOM",simcom_tx, "", 1, INT_MAX, true);
cmd_simcom->RegisterCommand("muxtx","Transmit data on SIMCOM MUX",simcom_muxtx, "<chan> <data>", 2, INT_MAX, true);
OvmsCommand* cmd_status = cmd_simcom->RegisterCommand("status","Show SIMCOM status",simcom_status, "", 0);
OvmsCommand* cmd_status = cmd_simcom->RegisterCommand("status","Show SIMCOM status",simcom_status, "[debug]", 0);
cmd_status->RegisterCommand("debug","Show extended SIMCOM status",simcom_status, "", 0);
cmd_simcom->RegisterCommand("cmd","Send SIMCOM AT command",simcom_cmd, "<command>", 1, INT_MAX, true);

Expand Down
1 change: 1 addition & 0 deletions vehicle/OVMS.V3/components/vehicle/vehicle.cpp
Expand Up @@ -1997,6 +1997,7 @@ void OvmsVehicle::BmsSetCellArrangementVoltage(int readings, int readingspermodu
m_bms_vdevmaxs = new float[readings];
if (m_bms_valerts != NULL) delete m_bms_valerts;
m_bms_valerts = new short[readings];
m_bms_valerts_new = 0;

m_bms_bitset_v.clear();
m_bms_bitset_v.reserve(readings);
Expand Down
5 changes: 5 additions & 0 deletions vehicle/OVMS.V3/components/vehicle_kiasoulev/src/ks_web.cpp
Expand Up @@ -24,6 +24,9 @@
* THE SOFTWARE.
*/

#include <sdkconfig.h>
#ifdef CONFIG_OVMS_COMP_WEBSERVER

//static const char *TAG = "v-kiasoulev";

#include <stdio.h>
Expand Down Expand Up @@ -291,3 +294,5 @@ void OvmsVehicleKiaSoulEv::GetDashboardConfig(DashboardConfig& cfg)
"{ from: 110, to: 125, className: 'red-band border' }]"
"}]";
}

#endif //CONFIG_OVMS_COMP_WEBSERVER
Expand Up @@ -349,11 +349,11 @@ OvmsVehicleKiaSoulEv::OvmsVehicleKiaSoulEv()

// init commands:
cmd_xks = MyCommandApp.RegisterCommand("xks","Kia Soul EV",NULL,"",0,0,true);
cmd_xks->RegisterCommand("trip","Show trip info since last parked", xks_trip_since_parked, 0,0, false);
cmd_xks->RegisterCommand("tripch","Show trip info since last charge", xks_trip_since_charge, 0,0, false);
cmd_xks->RegisterCommand("tpms","Tire pressure monitor", xks_tpms, 0,0, false);
cmd_xks->RegisterCommand("aux","Aux battery", xks_aux, 0,0, false);
cmd_xks->RegisterCommand("vin","VIN information", xks_vin, 0,0, false);
cmd_xks->RegisterCommand("trip","Show trip info since last parked", xks_trip_since_parked, "", 0,0, false);
cmd_xks->RegisterCommand("tripch","Show trip info since last charge", xks_trip_since_charge, "", 0,0, false);
cmd_xks->RegisterCommand("tpms","Tire pressure monitor", xks_tpms, "", 0,0, false);
cmd_xks->RegisterCommand("aux","Aux battery", xks_aux, "", 0,0, false);
cmd_xks->RegisterCommand("vin","VIN information", xks_vin, "", 0,0, false);
cmd_xks->RegisterCommand("IGN1","IGN1 relay", xks_ign1, "<on/off><pin>",1,1, false);
cmd_xks->RegisterCommand("IGN2","IGN2 relay", xks_ign2, "<on/off><pin>",1,1, false);
cmd_xks->RegisterCommand("ACC","ACC relay", xks_acc_relay, "<on/off><pin>",1,1, false);
Expand Down Expand Up @@ -387,9 +387,10 @@ OvmsVehicleKiaSoulEv::OvmsVehicleKiaSoulEv()
MyConfig.RegisterParam("xks", "Kia Soul EV spesific settings.", true, true);
ConfigChanged(NULL);

#ifdef CONFIG_OVMS_COMP_WEBSERVER
MyWebServer.RegisterPage("/bms/cellmon", "BMS cell monitor", OvmsWebServer::HandleBmsCellMonitor, PageMenu_Vehicle, PageAuth_Cookie);

WebInit();
#endif

// C-Bus
RegisterCanBus(1, CAN_MODE_ACTIVE, CAN_SPEED_500KBPS);
Expand All @@ -406,7 +407,9 @@ OvmsVehicleKiaSoulEv::OvmsVehicleKiaSoulEv()
OvmsVehicleKiaSoulEv::~OvmsVehicleKiaSoulEv()
{
ESP_LOGI(TAG, "Shutdown Kia Soul EV vehicle module");
#ifdef CONFIG_OVMS_COMP_WEBSERVER
MyWebServer.DeregisterPage("/bms/cellmon");
#endif
}

/**
Expand Down
Expand Up @@ -30,7 +30,9 @@
#define __VEHICLE_KIASOULEV_H__

#include "vehicle.h"
#ifdef CONFIG_OVMS_COMP_WEBSERVER
#include "ovms_webserver.h"
#endif

using namespace std;

Expand Down Expand Up @@ -313,6 +315,7 @@ class OvmsVehicleKiaSoulEv : public OvmsVehicle

const TickType_t xDelay = 50 / portTICK_PERIOD_MS;

#ifdef CONFIG_OVMS_COMP_WEBSERVER
// --------------------------------------------------------------------------
// Webserver subsystem
// - implementation: ks_web.(h,cpp)
Expand All @@ -326,6 +329,7 @@ class OvmsVehicleKiaSoulEv : public OvmsVehicle

public:
void GetDashboardConfig(DashboardConfig& cfg);
#endif //CONFIG_OVMS_COMP_WEBSERVER
};


Expand Down
103 changes: 101 additions & 2 deletions vehicle/OVMS.V3/components/vehicle_mitsubishi/src/mi_commands.cpp
Expand Up @@ -46,7 +46,7 @@ void xmi_aux(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, cons
* Print out information of the current trip.
*/
void xmi_trip(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
{
if (MyVehicleFactory.m_currentvehicle==NULL)
{
writer->puts("Error: No vehicle module selected");
Expand Down Expand Up @@ -102,4 +102,103 @@ void xmi_trip(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, con

if (*ODO != '-')
writer->printf("ODO %s\n", ODO);
}
}

void xmi_vin(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
if (MyVehicleFactory.m_currentvehicle==NULL)
{
writer->puts("Error: No vehicle module selected");
return;
}

OvmsVehicleMitsubishi* trio = (OvmsVehicleMitsubishi*) MyVehicleFactory.ActiveVehicle();

writer->printf("VIN\n");
if(strlen(trio->m_vin) != 0)
{
writer->printf("Vin: %s \n",trio->m_vin);
writer->printf("Car: ");
if(trio->m_vin[0] == 'J' && trio->m_vin[1] == 'F' && trio->m_vin[2] == '3'){
writer->printf("Mitsubishi i-MiEV \n");
}else if (trio->m_vin[0] == 'V' && trio->m_vin[1] == 'F'){
if (trio->m_vin[2] == '3'){
writer->printf("Peugeot iOn");
}else if(trio->m_vin[2] == '7'){
writer->printf("Citroen C-Zero ");
}
writer->printf("\n");
}
writer->printf("Battery cell count: ");
if (trio->m_vin[0] == 'V' && trio->m_vin[1] == 'F' && trio->m_vin[2] == 'Y'){
writer->printf("80 \n");
}else{
writer->printf("88 \n");
}
writer->printf("Modell year:");
switch (trio->m_vin[9]) {
case 'A':
{
writer->printf("2010");
break;
}
case 'B':
{
writer->printf("2011");
break;
}
case 'C':
{
writer->printf("2012");
break;
}
case 'D':
{
writer->printf("2013");
break;
}
case 'E':
{
writer->printf("2014");
break;
}
case 'F':
{
writer->printf("2015");
break;
}
case 'G':
{
writer->printf("2016");
break;
}
case 'H':
{
writer->printf("2017");
break;
}
case 'I':
{
writer->printf("2018");
break;
}
case 'J':
{
writer->printf("2019");
break;
}
case 'K':
{
writer->printf("2020");
break;
}
case 'L':
{
writer->printf("2021");
break;
}
}
}else{
writer->printf("No car VIN loaded!");
}
}

0 comments on commit 2666202

Please sign in to comment.