Subversion Repositories svnkaklik

Compare Revisions

Regard whitespace Rev 239 → Rev 246

/roboti/istrobot/camerus/SW/876/camerus.c
14,7 → 14,8
#define ODODO2 0x5E
 
// Adresy IIC periferii
#define CAMERA_ADR 0xC0
#define COMPAS_ADR 0xC0
#define CAMERA_ADR 0xDC
#define SONAR_ADR 0xE0
 
// A/D vstupy
212,6 → 213,8
#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);
226,7 → 229,17
return;
};
output_low(IRTX); // Zapni LED na detekci prekazky
delay_ms(10);
 
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);
if (!IRRX) // stale nas signal?
{
output_low(MOT_L); // neni odraz -> vpred
243,7 → 256,6
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
281,6 → 293,26
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;
291,12 → 323,20
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
 
339,7 → 379,7
 
//... Nastaveni kamery ...
i2c_start(); // Soft RESET kamery
i2c_write(CAMERA_ADR); // Pro single slave musi mit vsechny zapisy adresu C0h
i2c_write(CAMERA_ADR); // Adresa kamery
i2c_write(0x12); // Adresa registru COMH
i2c_write(0x80 | 0x24); // Zapis ridiciho slova
i2c_stop();
352,13 → 392,13
 
/*
i2c_start(); // Contrast (nema podstatny vliv na obraz)
i2c_write(0xC0);
i2c_write(CAMERA_ADR);
i2c_write(0x05);
i2c_write(0xA0); // 48h
i2c_stop();
 
i2c_start(); // Band Filter (pokud by byl problem se zarivkama 50Hz)
i2c_write(0xC0);
i2c_write(CAMERA_ADR);
i2c_write(0x2D);
i2c_write(0x04 | 0x03);
i2c_stop();
/roboti/istrobot/camerus/SW/876/objizdka_L.c
65,7 → 65,8
output_low(MOT_R);
};
 
if(IRRX) // hrozi celni srazka s cihlou v prubehu objizdeni
delta_bearing=bearing-bearing_offset;
if(IRRX || ((delta_bearing>64)&&(delta_bearing<128))) // hrozi celni srazka s cihlou v prubehu objizdeni
{
cas=CASMIN;
}
118,6 → 119,15
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;