同时,我买了两个Raspberry Pi Ultimate GPS Hat。我认为第一个 GPS 帽子可能坏了,但它们都表现出相同的行为 - 从 UART 接收的缓冲区完全充满了 0 值(512 字节)!
参见NmeaGpsModule类中的processBuffer(byte[] buffer, int count)方法。
private void processBuffer(byte[] buffer, int count) {
for (int i = 0; i < count; i++) {
if (mParser.getFrameStart() == buffer[i]) {
handleFrameStart();
} else if (mParser.getFrameEnd() == buffer[i]) {
handleFrameEnd();
} else if (buffer[i] != 0){
//Insert all other characters except '0's into the buffer
mMessageBuffer.put(buffer[i]);
}
}
}
我使用具有以下设置的GPS示例:
public static final int UART_BAUD = 9600;
public static final float ACCURACY = 2.5f; // From GPS datasheet
有任何想法吗?怎么了?