Private member naming

git-svn-id: https://arducopter.googlecode.com/svn/trunk@421 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
DrZiplok@gmail.com 2010-09-06 22:30:29 +00:00
parent 3e1cd1ea2e
commit a83f663942
2 changed files with 35 additions and 36 deletions

View File

@ -50,7 +50,7 @@ void AP_GPS_MTK::update(void)
data = _port->read(); data = _port->read();
restart: restart:
switch(step){ switch(_step){
// Message preamble, class, ID detection // Message preamble, class, ID detection
// //
@ -63,32 +63,32 @@ restart:
// //
case 0: case 0:
if(PREAMBLE1 == data) if(PREAMBLE1 == data)
step++; _step++;
break; break;
case 1: case 1:
if (PREAMBLE2 == data) { if (PREAMBLE2 == data) {
step++; _step++;
break; break;
} }
step = 0; _step = 0;
goto restart; goto restart;
case 2: case 2:
if (MESSAGE_CLASS == data) { if (MESSAGE_CLASS == data) {
step++; _step++;
ck_b = ck_a = data; // reset the checksum accumulators _ck_b = _ck_a = data; // reset the checksum accumulators
} else { } else {
step = 0; // reset and wait for a message of the right class _step = 0; // reset and wait for a message of the right class
goto restart; goto restart;
} }
break; break;
case 3: case 3:
if (MESSAGE_ID == data) { if (MESSAGE_ID == data) {
step++; _step++;
ck_b += (ck_a += data); _ck_b += (_ck_a += data);
payload_length = sizeof(buffer); // prepare to receive our message _payload_length = sizeof(diyd_mtk_msg); // prepare to receive our message
payload_counter = 0; _payload_counter = 0;
} else { } else {
step = 0; _step = 0;
goto restart; goto restart;
} }
break; break;
@ -96,24 +96,24 @@ restart:
// Receive message data // Receive message data
// //
case 4: case 4:
buffer.bytes[payload_counter++] = data; _buffer.bytes[_payload_counter++] = data;
ck_b += (ck_a += data); _ck_b += (_ck_a += data);
if (payload_counter == payload_length) if (_payload_counter == _payload_length)
step++; _step++;
break; break;
// Checksum and message processing // Checksum and message processing
// //
case 5: case 5:
step++; _step++;
if (ck_a != data) { if (_ck_a != data) {
_error("GPS_MTK: checksum error\n"); _error("GPS_MTK: checksum error\n");
step = 0; _step = 0;
} }
break; break;
case 6: case 6:
step = 0; _step = 0;
if (ck_b != data) { if (_ck_b != data) {
_error("GPS_MTK: checksum error\n"); _error("GPS_MTK: checksum error\n");
break; break;
} }
@ -122,24 +122,23 @@ restart:
} }
} }
// Private Methods // Private Methods
void void
AP_GPS_MTK::_parse_gps(void) AP_GPS_MTK::_parse_gps(void)
{ {
if (FIX_3D != buffer.msg.fix_type) { if (FIX_3D != _buffer.msg.fix_type) {
fix = false; fix = false;
} else { } else {
fix = true; fix = true;
latitude = _swapl(&buffer.msg.latitude) * 10; latitude = _swapl(&_buffer.msg.latitude) * 10;
longitude = _swapl(&buffer.msg.longitude) * 10; longitude = _swapl(&_buffer.msg.longitude) * 10;
altitude = _swapl(&buffer.msg.altitude); altitude = _swapl(&_buffer.msg.altitude);
ground_speed = _swapl(&buffer.msg.ground_speed); ground_speed = _swapl(&_buffer.msg.ground_speed);
ground_course = _swapl(&buffer.msg.ground_course) / 10000; ground_course = _swapl(&_buffer.msg.ground_course) / 10000;
num_sats = buffer.msg.satellites; num_sats = _buffer.msg.satellites;
// XXX docs say this is UTC, but our clients expect msToW // XXX docs say this is UTC, but our clients expect msToW
time = _swapl(&buffer.msg.utc_time); time = _swapl(&_buffer.msg.utc_time);
} }
new_data = true; new_data = true;
} }

View File

@ -66,19 +66,19 @@ private:
}; };
// Packet checksum accumulators // Packet checksum accumulators
uint8_t ck_a; uint8_t _ck_a;
uint8_t ck_b; uint8_t _ck_b;
// State machine state // State machine state
uint8_t step; uint8_t _step;
uint8_t payload_length; uint8_t _payload_length;
uint8_t payload_counter; uint8_t _payload_counter;
// Receive buffer // Receive buffer
union { union {
diyd_mtk_msg msg; diyd_mtk_msg msg;
uint8_t bytes[]; uint8_t bytes[];
} buffer; } _buffer;
// Buffer parse & GPS state update // Buffer parse & GPS state update
void _parse_gps(); void _parse_gps();