001/* 002 * Copyright (C) Cross The Road Electronics. All rights reserved. 003 * License information can be found in CTRE_LICENSE.txt 004 * For support and suggestions contact support@ctr-electronics.com or file 005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases 006 */ 007package com.ctre.phoenixpro.configs; 008 009import com.ctre.phoenixpro.StatusCode; 010import com.ctre.phoenixpro.configs.jni.ConfigJNI; 011import com.ctre.phoenixpro.spns.*; 012 013/** 014 * Configs to enable/disable various features of the Pigeon2. 015 * <p> 016 * These configs allow the user to enable or disable various aspects 017 * of the Pigeon2. 018 */ 019public class Pigeon2FeaturesConfigs implements ParentConfiguration 020{ 021 /** 022 * Turns on or off the magnetometer fusing for 9-axis. FRC users are 023 * not recommended to turn this on, as the magnetic influence of the 024 * robot will likely negatively affect the performance of the Pigeon2. 025 * 026 * <ul> 027 * <li> <b>Default Value:</b> False 028 * </ul> 029 */ 030 public boolean EnableCompass = false; 031 /** 032 * Disables using the temperature compensation feature 033 * 034 * <ul> 035 * <li> <b>Default Value:</b> False 036 * </ul> 037 */ 038 public boolean DisableTemperatureCompensation = false; 039 /** 040 * Disables using the no-motion calibration feature 041 * 042 * <ul> 043 * <li> <b>Default Value:</b> False 044 * </ul> 045 */ 046 public boolean DisableNoMotionCalibration = false; 047 048 @Override 049 public String toString() 050 { 051 String ss = "Config Group: Pigeon2Features\n"; 052 ss += "Name: \"EnableCompass\" Value: \"" + EnableCompass + "\"" + "\n"; 053 ss += "Name: \"DisableTemperatureCompensation\" Value: \"" + DisableTemperatureCompensation + "\"" + "\n"; 054 ss += "Name: \"DisableNoMotionCalibration\" Value: \"" + DisableNoMotionCalibration + "\"" + "\n"; 055 return ss; 056 } 057 058 /** 059 * 060 */ 061 public StatusCode deserialize(String string) 062 { 063 EnableCompass = ConfigJNI.Deserializeboolean(SpnValue.Pigeon2UseCompass.value, string); 064 DisableTemperatureCompensation = ConfigJNI.Deserializeboolean(SpnValue.Pigeon2DisableTemperatureCompensation.value, string); 065 DisableNoMotionCalibration = ConfigJNI.Deserializeboolean(SpnValue.Pigeon2DisableNoMotionCalibration.value, string); 066 return StatusCode.OK; 067 } 068 069 /** 070 * 071 */ 072 public String serialize() 073 { 074 String ss = ""; 075 ss += ConfigJNI.Serializeboolean(910, EnableCompass); 076 ss += ConfigJNI.Serializeboolean(945, DisableTemperatureCompensation); 077 ss += ConfigJNI.Serializeboolean(947, DisableNoMotionCalibration); 078 return ss; 079 } 080} 081