mkopa / speeed

Awesome E-bike Configuration Tool and Display

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Display: limit the speed, legal or max

Chris741233 opened this issue · comments

Hello, very nice job ! :)
The display does not have the ability to limit the speed, legal or max for exemple.
You can control with the 0x16, 0x1F, RPM, CRC :))

// --- EXEMPLE ------------
// --- Jacques74 2021 -----

// ----------- Constantes or variables 
const float CIRC_WHEEL = 2.166; // Wheel Circumference in meter
const byte LEGAL_SPEED = 25; 		// Legal speed in km/h (work only in PAS)
const byte FULL_SPEED = 45; 		// Full speed in km/h (work only in PAS)
#define W_CRC 0x00 							//  CRC (checksum) 

// -- exemple func:
// Limit_Rpm(LEGAL_SPEED);


// --------- Function limit RPM (bridage speed console)
// --- Send just on time where display start, or send in loop (not obligatory)
void Limit_Rpm(byte speedLimit) {
  // exemple de ligne a envoyer pour bridage vitesse : (0x16, 0x1F, 0x00, 0xC8, 0xFD)
  int st = 0;
  unsigned int RpmMax = (speedLimit / CIRC_WHEEL / 60) * 1000;
  byte b_rpm1 = RpmMax >> 8;
  byte b_rpm2 = RpmMax & 0xFF;

  //byte oct[5] = {0x16, 0x1F, RpmMax >> 8, RpmMax & 0xFF, W_CRC};
  byte oct[5] = {0x16, 0x1F, b_rpm1, b_rpm2, W_CRC};

  // Calcul Checksum - total des octets sans le dernier octet (CRC)
  for (byte i = 0; i <= 3; i ++) {
    st = st + oct[i];
  }
  oct[4] = st % 256; // modulo et update CRC : Modulo peu indispensable ici !!
  for (byte i = 0; i <= 4; i++) {
    MySerial1.write(oct[i]);
  }
} //endfunc

It's possible also to limit Throttle with programed speed throttle and dedicated level for throttle
Expl for Legal 6-8 Km/h Throttle:
Throttle speed limit = 15 Km/h (minimum) and dedicated level = 50% speed
= ~ 6-8 Km/h max

I am hoping someone can help me out here. No matter what order I hook up the android app to the motor and the app keeps telling me no device found when trying to connect.tried different cables tried different order of hooking up the usb etc. this is a very recent 500 watt motor. Paul Bruins