-
Notifications
You must be signed in to change notification settings - Fork 815
docs : Added automatic scalling for graphs #2708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis PR enables automatic Y-axis scaling in all data visualization fragments by removing fixed limits and integrating MPAndroidChart’s auto-scale methods, enriches documentation with a detailed Robotic Arm guide and new navigation entries, corrects the MPU6050 I2C address mappings across sensor classes, implements real-time servoWrite logic for the robotic arm controls, and introduces UI/menu enhancements including toast feedback and external documentation links. Sequence Diagram for Real-time Robotic Arm Servo ControlsequenceDiagram
actor User
participant SeekArcSlider
participant RoboticArmActivity
participant PSLabHardware
User->>SeekArcSlider: Adjusts servo position
SeekArcSlider->>RoboticArmActivity: onProgressChanged(progress, fromUser)
RoboticArmActivity->>RoboticArmActivity: Calculate angle from progress
alt PSLab Connected
RoboticArmActivity->>PSLabHardware: scienceLab.servoWrite(servoIndex, angle)
end
Entity Relationship Diagram for RoboticArmProfile DataerDiagram
RoboticArmProfile {
string profileName PK "Name of the profile"
int servo1Angle "Angle for Servo 1"
int servo2Angle "Angle for Servo 2"
int servo3Angle "Angle for Servo 3"
int servo4Angle "Angle for Servo 4"
}
User ||--o{ RoboticArmProfile : Manages
Updated Class Diagram for Sensor Data Fragments Auto-ScalingclassDiagram
class GyroscopeDataFragment {
+LineChart getChart()
#void visualizeData()
}
class AccelerometerDataFragment {
+LineChart getChart()
#void visualizeData()
}
class LuxMeterDataFragment {
+void onResume()
}
class BaroMeterDataFragment {
+void onResume()
}
class ThermometerDataFragment {
+void onResume()
}
Updated Class Diagram for Activity Logic ModificationsclassDiagram
class RoboticArmActivity {
#void onCreate(Bundle savedInstanceState)
}
class SettingsActivity {
#void onCreate(Bundle savedInstanceState)
+boolean onCreateOptionsMenu(Menu menu)
+boolean onOptionsItemSelected(MenuItem item)
}
class CreateConfigActivity {
+boolean onOptionsItemSelected(MenuItem item)
}
Updated Class Diagram for Sensor Address ConfigurationclassDiagram
class MPU6050 {
-int ADDRESS = 0x69
}
class MPU925x {
-int ADDRESS = 0x69
}
class SensorActivity {
#Map~Integer, String~ sensorAddr
}
class SensorDataLoggerActivity {
#Map~Integer, String~ sensorAddress
}
class SensorList {
#Map~Integer, String[]~ sensorList
}
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ChehakTrehan - I've reviewed your changes and found some issues that need to be addressed.
Blocking issues:
- Typo causing compile error (link)
Here's what I looked at during the review
- 🔴 General issues: 1 blocking issue, 5 other issues
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
myButton.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Toast.makeText(CompassActivity.this, "Button clicked!", Toast.LENGTH_SHORT).show(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Incorrect context in Toast call
Use SettingsActivity.this or simply this as the context to avoid confusion and potential memory leaks.
@@ -95,12 +103,29 @@ | |||
getSupportFragmentManager().beginTransaction().add(R.id.content, fragment).commit(); | |||
} | |||
} | |||
@Override | |||
public boolean onCreateOptionsMenu(Menu menu) { | |||
getMenuInflater().inflate(R.menu.activity_compass_help_menu, menu); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Menu resource seems misnamed
The use of 'activity_compass_help_menu' in SettingsActivity suggests a copy-paste error. Please use a menu resource appropriate for settings.
if (item.getItemId() == android.R.id.home) { | ||
finish(); | ||
finish();rea | ||
}else if (item.getItemId() == R.id.compass_help_icon) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (typo): Typo causing compile error
Remove the extra "rea" after finish() to fix the syntax error.
if (item.getItemId() == android.R.id.home) { | |
finish(); | |
finish();rea | |
}else if (item.getItemId() == R.id.compass_help_icon) { | |
if (item.getItemId() == android.R.id.home) { | |
finish(); | |
}else if (item.getItemId() == R.id.compass_help_icon) { | |
@@ -25,7 +25,7 @@ public SensorList() { | |||
sensorList.put(0x5A, new String[]{"MLX90614 PIR temperature"}); | |||
sensorList.put(0x1E, new String[]{"HMC5883L magnetometer", "LSM303 magnetometer"}); | |||
sensorList.put(0x77, new String[]{"BMP180/GY-68 altimeter", "MS5607", "MS5611"}); | |||
sensorList.put(0x68, new String[]{"MPU-6050/GY-521 accel+gyro+temp", "ITG3200", "DS1307", "DS3231"}); | |||
sensorList.put(0x69, new String[]{"MPU-6050/GY-521 accel+gyro+temp", "ITG3200", "DS1307", "DS3231"}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Conflicting sensorList key
0x69 is assigned to two different sensor sets, causing one to overwrite the other. Please ensure each key is unique or combine the sensor sets as needed.
@@ -435,7 +438,16 @@ private void visualizeData() { | |||
LineData data = new LineData(dataSet); | |||
|
|||
fragment.setChartData(data); | |||
|
|||
fragment.setYaxis(highLimit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Fixed Y-axis conflicting with auto-scaling
Remove setYaxis(highLimit) to allow auto-scaling to function as intended.
mChart.getAxisLeft().resetAxisMaximum(); | ||
mChart.getAxisRight().resetAxisMinimum(); | ||
mChart.getAxisRight().resetAxisMaximum(); | ||
initiateBaroSensor(sensorType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Erroneous initialization of non-thermometer sensors
Remove the initialization of Baro and Lux sensors from ThermometerDataFragment to ensure only the thermometer sensor is started.
Fixes #
Changes
Screenshots / Recordings
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard coding any value.strings.xml
,dimens.xml
orcolors.xml
.Summary by Sourcery
Enable automatic scaling for sensor data graphs, fix the MPU6050 I2C address, expand documentation for the Robotic Arm feature, and add compass help and UI enhancements in settings.
New Features:
Bug Fixes:
Enhancements:
Documentation: