diff --git a/src/devices/rtc_ds1307.cc b/src/devices/rtc_ds1307.cc index cf6335b4..acc99ece 100644 --- a/src/devices/rtc_ds1307.cc +++ b/src/devices/rtc_ds1307.cc @@ -37,7 +37,7 @@ } else \ printf -enum { DS_SECONDS = 0, DS_MINUTES, DS_HOURS, DS_DAY, DS_DATE, DS_MONTH, DS_YEAR, DS_CONTROL }; +enum { DS_SECONDS = 0, DS_MINUTES, DS_HOURS, DS_DAY, DS_DATE, DS_MONTH, DS_YEAR, DS_CTRL }; #ifdef _DEBUG static char buff[30]; @@ -69,7 +69,7 @@ const char* get_addr_str(const unsigned char addr, const unsigned char data) { case DS_YEAR: sprintf(buff, "YEAR [%02X] = %02X", addr, data); break; - case DS_CONTROL: + case DS_CTRL: sprintf(buff, "CONTROL [%02X] = %02X", addr, data); break; default: @@ -265,7 +265,7 @@ void rtc_ds1307_init(rtc_ds1307_t* rtc, board* pboard_) { memset(rtc->data, 0xFF, 8); rtc->data[DS_HOURS] &= 0x3F; // 24h mode - rtc->data[DS_CONTROL] = 0; + rtc->data[DS_CTRL] = 0; rtc_ds1307_rst(rtc); utime = time(NULL); @@ -404,4 +404,4 @@ unsigned char rtc_ds1307_I2C_io(rtc_ds1307_t* rtc, unsigned char scl, unsigned c return ret; } -// TODO int output \ No newline at end of file +// TODO int output diff --git a/src/parts/output_Buzzer.cc b/src/parts/output_Buzzer.cc index 7e1f1688..a43c1fb1 100644 --- a/src/parts/output_Buzzer.cc +++ b/src/parts/output_Buzzer.cc @@ -305,14 +305,16 @@ void cpart_Buzzer::PostProcess(void) { } } } else if (btype == PASSIVE) { - buffer[buffercount - 1] = 0; - short* ptr[2]; - ptr[0] = (short int*)&buffercount; - ptr[1] = buffer; - /*int ret =*/PICSimLab.SystemCmd(PSC_AUDIOCHSOUNDPLAY, (const char*)&buzzerId, ptr); - // printf("ret=%i buffercount=%i sample=%i time=%f timer=%i\n", ret, buffercount, samplerate, - // ((float)(buffercount)) / samplerate, timer->GetTime()); - buffercount = 0; + if (buffercount) { + buffer[buffercount - 1] = 0; + short* ptr[2]; + ptr[0] = (short int*)&buffercount; + ptr[1] = buffer; + /*int ret =*/PICSimLab.SystemCmd(PSC_AUDIOCHSOUNDPLAY, (const char*)&buzzerId, ptr); + // printf("ret=%i buffercount=%i sample=%i time=%f timer=%i\n", ret, buffercount, samplerate, + // ((float)(buffercount)) / samplerate, timer->GetTime()); + buffercount = 0; + } } else // TONE { float freq;