mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
sync from main
This commit is contained in:
@@ -1221,18 +1221,18 @@ limitations under the License.
|
||||
</string>
|
||||
<string name="settings_display_track_color_dynamic_medium"
|
||||
translation_description="In the Display settings, under the 'Dynamic thresholds' configurations,
|
||||
the option for configuring the medium speed percentage. It is the percentage from the average
|
||||
speed to be considered as the medium speed. The track color mode will use different colors to
|
||||
color a track depending on whether the speed is above, in, or below the medium speed range.">
|
||||
Medium speed percentage
|
||||
the option for configuring the percentage from the average speed to be considered as the
|
||||
medium speed. The track color mode will use different colors to color a track depending on
|
||||
whether the speed is above, in, or below the medium speed range.">
|
||||
Medium percentage
|
||||
</string>
|
||||
<string name="settings_display_track_color_dynamic_medium_summary"
|
||||
translation_description="In the Display settings, under the 'Dynamic thresholds' configurations,
|
||||
the summary for the 'Medium speed percentage' option explaining that it sets a percentage from
|
||||
the average speed to be considered as the medium speed color. The track color mode will use
|
||||
the summary for the 'Medium percentage' option explaining that it sets the percentage from
|
||||
the average speed to be considered as the medium speed. The track color mode will use
|
||||
different colors to color a track depending on whether the speed is above, in, or below the
|
||||
medium speed range.">
|
||||
Percentage from the average speed for the medium speed color.
|
||||
Percentage from the average speed for the medium speed range.
|
||||
</string>
|
||||
<string name="settings_display_track_color_fixed"
|
||||
translation_description="In the Display settings, for the 'Track color mode' dropdown, the
|
||||
@@ -1273,7 +1273,7 @@ limitations under the License.
|
||||
<string name="settings_display_track_color_summary"
|
||||
translation_description="In the Display settings, the summary for the 'Track color mode'
|
||||
dropdown explaining that it configures how colors are used to color a track based on speed.">
|
||||
The way to color a track based on speed.
|
||||
The way to color a track based on slow, medium, and high speed.
|
||||
</string>
|
||||
<string name="settings_not_while_recording"
|
||||
translation_description="In the Settings page, the summary for an option that is not available
|
||||
|
||||
@@ -25,8 +25,8 @@ public class AntMessage {
|
||||
|
||||
/** Build a short value from its constituent bytes */
|
||||
protected static short decodeShort(byte b0, byte b1) {
|
||||
short value = b0;
|
||||
value |= ((short) b1) << 8;
|
||||
return value;
|
||||
int value = b0 & 0xFF;
|
||||
value |= (b1 & 0xFF) << 8;
|
||||
return (short)value;
|
||||
}
|
||||
}
|
||||
|
||||
+24
-13
@@ -92,7 +92,7 @@ public abstract class AntSensorManager extends SensorManager {
|
||||
String antAction = intent.getAction();
|
||||
Log.i(TAG, "enter data onReceive" + antAction);
|
||||
|
||||
if (antAction.equals(AntInterfaceIntent.ANT_RX_MESSAGE_ACTION)) {
|
||||
if (antAction != null && antAction.equals(AntInterfaceIntent.ANT_RX_MESSAGE_ACTION)) {
|
||||
byte[] antMessage = intent.getByteArrayExtra(AntInterfaceIntent.ANT_MESSAGE);
|
||||
if (DEBUGGING) {
|
||||
Log.d(TAG, "Received RX message " + messageToString(antMessage));
|
||||
@@ -185,22 +185,23 @@ public abstract class AntSensorManager extends SensorManager {
|
||||
* Cleans up the ANT+ receiver interface, by releasing the interface
|
||||
* and destroying it.
|
||||
*/
|
||||
private void cleanAntInterface()
|
||||
{
|
||||
private void cleanAntInterface() {
|
||||
Log.i(TAG, "Destroying AntSensorManager");
|
||||
|
||||
if (antReceiver != null) {
|
||||
try {
|
||||
antReceiver.releaseInterface();
|
||||
} catch (AntServiceNotConnectedException e) {
|
||||
Log.i(TAG, "ANT service not connected", e);
|
||||
} catch (AntInterfaceException e) {
|
||||
Log.e(TAG, "failed to release ANT interface", e);
|
||||
|
||||
try {
|
||||
if (antReceiver == null) {
|
||||
Log.e(TAG, "no ANT receiver");
|
||||
return;
|
||||
}
|
||||
|
||||
antReceiver.releaseInterface();
|
||||
antReceiver.destroy();
|
||||
|
||||
antReceiver = null;
|
||||
} catch (AntServiceNotConnectedException e) {
|
||||
Log.i(TAG, "ANT service not connected", e);
|
||||
} catch (AntInterfaceException e) {
|
||||
Log.e(TAG, "failed to release ANT interface", e);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "run-time exception when cleaning the ANT interface", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,6 +214,11 @@ public abstract class AntSensorManager extends SensorManager {
|
||||
Log.d(TAG, "ANT service connected");
|
||||
|
||||
try {
|
||||
if (antReceiver == null) {
|
||||
Log.e(TAG, "no ANT receiver");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!antReceiver.claimInterface()) {
|
||||
Log.e(TAG, "failed to claim ANT interface");
|
||||
return;
|
||||
@@ -300,6 +306,11 @@ public abstract class AntSensorManager extends SensorManager {
|
||||
byte radioFreq, byte proxSearch) {
|
||||
|
||||
try {
|
||||
if (antReceiver == null) {
|
||||
Log.e(TAG, "no ANT receiver");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Assign as slave channel on selected network (0 = public, 1 = ANT+, 2 =
|
||||
// ANTFS)
|
||||
antReceiver.ANTAssignChannel(channelNumber, AntDefine.PARAMETER_RX_NOT_TX, networkNumber);
|
||||
|
||||
Reference in New Issue
Block a user