mirror of
https://github.com/KostyaSha/arduino-iebus.git
synced 2025-06-20 13:56:09 +00:00
Adjust timeouts
This commit is contained in:
parent
fde8d708ca
commit
da0f1fd9f3
@ -79,8 +79,8 @@ const AvcOutMessage CmdLanCheckOk PROGMEM = {AVC_MSG_DIRECT, 0x06, {0x00
|
||||
|
||||
// AVCLan CDchanger & timer1 init,
|
||||
void AVCLanCDch::begin(){
|
||||
avclan.deviceAddress = 0x0240;
|
||||
|
||||
// avclan.deviceAddress = 0x0240;
|
||||
avclan.deviceAddress = 0x0360;
|
||||
// timer1 setup, prescaler factor - 1024
|
||||
TCCR1A = 0; // normal mode
|
||||
TCCR1B = 5; // Prescaler /1024
|
||||
|
@ -114,9 +114,10 @@ byte AVCLanDrv::_readMessage (){
|
||||
TCCR2B=0x02; // prescaler 8
|
||||
|
||||
if (t < AVC_START_BIT_HOLD_ON_MIN_LENGTH){
|
||||
//if (t < 0x16){
|
||||
SREG = oldSREG;
|
||||
return 2;
|
||||
bSerial.print("Error t < AVC_START_BIT_HOLD_ON_MIN_LENGTH: ");
|
||||
bSerial.printHex8(t);
|
||||
SREG = oldSREG;
|
||||
return 2;
|
||||
}
|
||||
|
||||
broadcast = readBits(1);
|
||||
@ -391,6 +392,11 @@ bool AVCLanDrv::handleAcknowledge (void){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (broadcast == AVC_MSG_DIRECT){
|
||||
// Acknowledge.
|
||||
send1BitWord(1);
|
||||
return true;
|
||||
}
|
||||
// Return acknowledge bit.
|
||||
return readAcknowledge();
|
||||
}
|
||||
@ -495,15 +501,37 @@ void AVCLanDrv::printMessage(bool incoming){
|
||||
}
|
||||
bSerial.printHex4(masterAddress >> 8);
|
||||
bSerial.printHex8(masterAddress);
|
||||
bSerial.print(" ");
|
||||
bSerial.print("->");
|
||||
|
||||
bSerial.printHex4(slaveAddress >> 8);
|
||||
bSerial.printHex8(slaveAddress);
|
||||
bSerial.print(" ");
|
||||
bSerial.printHex8(dataSize);
|
||||
if (slaveAddress == 0x0FFF) {
|
||||
bSerial.print(" ");
|
||||
} else {
|
||||
bSerial.print(" ");
|
||||
}
|
||||
|
||||
for (byte i = 0; i < dataSize; i++){
|
||||
for (byte i = 0; i < dataSize; i++) {
|
||||
bSerial.printHex8(message[i]);
|
||||
if (i == 0) {
|
||||
if (slaveAddress == 0x01FF) { // separate logical src and dst addrs
|
||||
bSerial.print(" ");
|
||||
} else if (slaveAddress == 0x0FFF) {
|
||||
|
||||
} else {
|
||||
bSerial.print("->");
|
||||
}
|
||||
} else if (i == 1) {
|
||||
if (slaveAddress == 0x01FF) {
|
||||
// bSerial.print(" ");
|
||||
} else if (slaveAddress == 0x0FFF) {
|
||||
|
||||
} else {
|
||||
bSerial.print(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
bSerial.println();
|
||||
|
||||
@ -576,4 +604,4 @@ void AVCLanDrv::loadMessage(AvcOutMessage *msg){
|
||||
}
|
||||
};
|
||||
|
||||
AVCLanDrv avclan;
|
||||
AVCLanDrv avclan;
|
||||
|
@ -45,10 +45,11 @@
|
||||
#define AVC_BIT_1_HOLD_ON_LENGTH 0x28 // 20 uS * (F_CPU / 1000000L / 8)
|
||||
#define AVC_BIT_0_HOLD_ON_LENGTH 0x40 // 32 uS * (F_CPU / 1000000L / 8)
|
||||
//#define AVC_BIT_0_HOLD_ON_MIN_LENGTH 0x34 // 26 uS * (F_CPU / 1000000L / 8) Compare half way between a '1' (20 us) and a '0' (32 us ): 32 - (32 - 20) /2 = 26 us
|
||||
#define AVC_BIT_0_HOLD_ON_MIN_LENGTH 0x3C // 30 uS * (F_CPU / 1000000L / 8) Compare half way between a '1' (20 us) and a '0' (32 us ): 32 - (32 - 20) /2 = 26 us
|
||||
#define AVC_BIT_0_HOLD_ON_MIN_LENGTH 0x32 // from pc car forum
|
||||
//#define AVC_BIT_0_HOLD_ON_MIN_LENGTH 0x3C // 30 uS * (F_CPU / 1000000L / 8) Compare half way between a '1' (20 us) and a '0' (32 us ): 32 - (32 - 20) /2 = 26 us
|
||||
#define AVC_START_BIT_LENGTH 0x5D // 186 uS * (F_CPU / 1000000L / 32) , prescaler 32
|
||||
#define AVC_START_BIT_HOLD_ON_LENGTH 0x54 // 168 uS * (F_CPU / 1000000L / 32) prescaler 32
|
||||
#define AVC_START_BIT_HOLD_ON_MIN_LENGTH 0x16 // 44 uS * (F_CPU / 1000000L / 32) grater that AVC_NORMAL_BIT_LENGTH, prescaler 32
|
||||
#define AVC_START_BIT_HOLD_ON_MIN_LENGTH 0x09 // 44 uS * (F_CPU / 1000000L / 32) grater that AVC_NORMAL_BIT_LENGTH, prescaler 32
|
||||
#define AVC_1U_LENGTH 0x02 // 1 uS * (F_CPU / 1000000L / 8)
|
||||
|
||||
#define AVC_MAXMSGLEN 32
|
||||
@ -104,6 +105,7 @@ class AVCLanDrv{
|
||||
byte event;
|
||||
byte actionID;
|
||||
bool readonly;
|
||||
bool log;
|
||||
void begin ();
|
||||
byte readMessage (void);
|
||||
byte sendMessage (void);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include "AVCLanDrv.h"
|
||||
#include "WProgram.h"
|
||||
#include "Arduino.h"
|
||||
|
||||
#define AVCLANDEVICE_NAME " Navi"
|
||||
#define AVCLANDEVICE_VERSION "0.0.1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user