Subversion Repositories svnkaklik

Compare Revisions

Regard whitespace Rev 246 → Rev 239

/roboti/istrobot/camerus/SW/876/camerus.c
14,8 → 14,7
#define ODODO2 0x5E
 
// Adresy IIC periferii
#define COMPAS_ADR 0xC0
#define CAMERA_ADR 0xDC
#define CAMERA_ADR 0xC0
#define SONAR_ADR 0xE0
 
// A/D vstupy
213,8 → 212,6
#int_EXT
EXT_isr() // Preruseni od prekazky
{
int8 bearing, bearing_offset, delta_bearing;
set_pwm1_duty(0); // zabrzdi levym kolem, prave vypni
set_pwm2_duty(0);
output_high(MOT_L);
229,17 → 226,7
return;
};
output_low(IRTX); // Zapni LED na detekci prekazky
 
i2c_start(); // Cteni kompasu
i2c_write(COMPAS_ADR);
i2c_write(0x1);
i2c_stop();
i2c_start();
i2c_write(COMPAS_ADR+1);
bearing_offset=i2c_read(0);
i2c_stop();
 
delay_ms(9);
delay_ms(10);
if (!IRRX) // stale nas signal?
{
output_low(MOT_L); // neni odraz -> vpred
256,6 → 243,7
bb_f[log]=0xFF; // Cihla
if(log<MAXLOG) log++; // Ukazatel na dalsi zaznam
};
//!!! Vyzkouset, ze nepreteka LOG
 
//!!! if(stav==cihla) while(true); // Zastav na furt, konec drahy
// if(stav==cihla) return; // Po druhe nic neobjizdej
293,26 → 281,6
output_low(MOT_L); // Nastav smer vpred
output_low(MOT_R);
 
disp(0); // Zhasni LEDbar
/*!!!!
while(true)
{
int8 ble;
 
i2c_start(); // Cteni kompasu
i2c_write(COMPAS_ADR);
i2c_write(0x1);
i2c_stop();
i2c_start();
i2c_write(COMPAS_ADR+1);
ble=i2c_read(0);
i2c_stop();
disp(ble);
delay_ms(200);
}
//*/
 
if(BUMPER) // Kdyz nekdo na zacatku drzi naraznik, vymaz log
{
int8 n;
323,20 → 291,12
SaveLog(0); // Zapis do EEPROM pocet zaznamu 0, tedy jeden zaznam
while(true)
{
if(!IRRX)
{
disp(0x55); // Blikni pro potvrzeni
delay_ms(200);
disp(0xAA);
delay_ms(200);
}
else
{
disp(0x81); // Diagnostika celniho IR senzoru na prekazku
delay_ms(200);
}
}
}
 
output_low(IRTX); // Zapni LED na detekci prekazky
 
379,7 → 339,7
 
//... Nastaveni kamery ...
i2c_start(); // Soft RESET kamery
i2c_write(CAMERA_ADR); // Adresa kamery
i2c_write(CAMERA_ADR); // Pro single slave musi mit vsechny zapisy adresu C0h
i2c_write(0x12); // Adresa registru COMH
i2c_write(0x80 | 0x24); // Zapis ridiciho slova
i2c_stop();
392,13 → 352,13
 
/*
i2c_start(); // Contrast (nema podstatny vliv na obraz)
i2c_write(CAMERA_ADR);
i2c_write(0xC0);
i2c_write(0x05);
i2c_write(0xA0); // 48h
i2c_stop();
 
i2c_start(); // Band Filter (pokud by byl problem se zarivkama 50Hz)
i2c_write(CAMERA_ADR);
i2c_write(0xC0);
i2c_write(0x2D);
i2c_write(0x04 | 0x03);
i2c_stop();
/roboti/istrobot/camerus/SW/876/objizdka_L.c
65,8 → 65,7
output_low(MOT_R);
};
 
delta_bearing=bearing-bearing_offset;
if(IRRX || ((delta_bearing>64)&&(delta_bearing<128))) // hrozi celni srazka s cihlou v prubehu objizdeni
if(IRRX) // hrozi celni srazka s cihlou v prubehu objizdeni
{
cas=CASMIN;
}
119,15 → 118,6
vzdalenost=i2c_read(0);
i2c_stop();
 
i2c_start(); // Cteni kompasu
i2c_write(COMPAS_ADR);
i2c_write(0x1); // uhel 0-255
i2c_stop();
i2c_start();
i2c_write(COMPAS_ADR+1);
bearing=i2c_read(0);
i2c_stop();
 
if(touch==L_TOUCH) disp(0xC0);
if(touch==R_TOUCH) disp(0x03);
if((touch==B_TOUCH)&&(ridic==pred_carou)) ridic=na_care;