fix testsending

This commit is contained in:
interfisch 2021-03-26 17:03:02 +01:00
parent 994571b60e
commit b90204dc1a
1 changed files with 11 additions and 11 deletions

View File

@ -69,14 +69,14 @@ void draw() {
if (loopmillis>last_send+20) {
last_send=loopmillis;
String wstring=time+","+cmd_FrontL+","+cmd_FrontR+","+cmd_RearL+","+cmd_RearR+","+current_FrontL+","+current_FrontR+","+current_RearL+","+current_RearR+","+speed_FrontL+","+speed_FrontR+","+speed_RearL+","+speed_RearR+","+temp_Front+","+temp_Rear+","+vbat_Front+","+vbat_Rear+","+currentAll+","+throttle+","+brake+"\n";
String wstring=time+","+cmd_FrontL+","+cmd_FrontR+","+cmd_RearL+","+cmd_RearR+","+nfc(current_FrontL,3)+","+nfc(current_FrontR,3)+","+nfc(current_RearL,3)+","+nfc(current_RearR,3)+","+speed_FrontL+","+speed_FrontR+","+speed_RearL+","+speed_RearR+","+nfc(temp_Front,2)+","+nfc(temp_Rear,2)+","+nfc(vbat_Front,2)+","+nfc(vbat_Rear,2)+","+nfc(currentAll,3)+","+throttle+","+brake+"\n";
serial.write(wstring);
print(wstring);
}
if (loopmillis>last_update+20) {
last_update=loopmillis;
n1+=0.1;
n1+=0.02;
time=loopmillis/1000.0;
updateValues();
}
@ -86,14 +86,14 @@ void draw() {
void updateValues() {
cmd_FrontL=int(noise(n1,0)*1000);
cmd_FrontR=int(noise(n1,0.001)*1000);
cmd_RearL=int(noise(n1,0.02)*1000);
cmd_RearR=int(noise(n1,0.021)*1000);
current_FrontL=noise(n1,2)*10-3;
current_FrontR=noise(n1,2.001)*10-3;
current_RearL=noise(n1,2.02)*10-3;
current_RearR=noise(n1,2.021)*10-3;
cmd_FrontL=int(noise(n1,2)*1000);
cmd_FrontR=int(noise(n1,2.001)*1000);
cmd_RearL=int(noise(n1,2.02)*1000);
cmd_RearR=int(noise(n1,2.021)*1000);
current_FrontL=noise(n1-5,2)*10-3;
current_FrontR=noise(n1-5,2.2)*10-3;
current_RearL=noise(n1-5,2.4)*10-3;
current_RearR=noise(n1-5,2.6)*10-3;
speed_FrontL=int(noise(n1,5)*600);
speed_FrontR=int(noise(n1,5.001)*600);
speed_RearL=int(noise(n1,5.02)*600);
@ -102,7 +102,7 @@ void updateValues() {
temp_Rear=noise(n1/100.0,10.1)*3+30;
vbat_Front=-noise(n1/100.0,11)*4+12*4.2;
vbat_Rear=-noise(n1/100.0,11.2)*4+12*4.2;
currentAll=min(current_FrontL,current_FrontR,min(speed_RearL,speed_RearR));
currentAll=min(current_FrontL,min(current_FrontR,min(speed_RearL,speed_RearR)));
throttle=int(noise(n1,15)*1000);
brake=max(0,int(noise(n1,18)*1000-800));
}