Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/linters/.codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
# Android attribute names that look like typos
ignore-words-list = showin
2 changes: 2 additions & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ jobs:
VALIDATE_JSCPD: false
# the Java code follows Android Studio style, not Google Java style
VALIDATE_GOOGLE_JAVA_FORMAT: false
# checkstyle enforces Sun style (80 char lines, javadoc on every field), which this code does not follow
VALIDATE_JAVA: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import java.io.File;

import in.co.gorest.grblcontroller.BR;
import in.co.gorest.grblcontroller.model.Constants;
import in.co.gorest.grblcontroller.util.GrblUtils;
import in.co.gorest.grblcontroller.GrblController;
import in.co.gorest.grblcontroller.R;

public class FileSenderListener extends BaseObservable {

Expand Down Expand Up @@ -60,7 +60,7 @@ public static void resetClass(){

private FileSenderListener(){
this.setStatus(STATUS_IDLE);
this.gcodeFileName = " " + GrblUtils.implode(" | ", Constants.SUPPORTED_FILE_TYPES);
this.gcodeFileName = GrblController.getInstance().getString(R.string.text_select_gcode_file);
this.gcodeFile = null;
this.rowsInFile = 0;
this.rowsSent = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public interface Constants {
String MACHINE_STATUS_HOME = "Home";
String MACHINE_STATUS_NOT_CONNECTED = "Unknown";

String[] SUPPORTED_FILE_TYPES = {".tap",".gcode", ".nc", ".ngc", ".fnc", ".txt"};
String SUPPORTED_FILE_TYPES_STRING = "^.*\\.(tap|gcode|nc|ngc|cnc|txt|ncc|fnc|dnc|fan|gc|txt|ncg|ncp|fgc)$";
// G-code file extensions the file tab accepts. The check regex is built from this list.
String[] SUPPORTED_FILE_EXTENSIONS = {"tap", "gcode", "nc", "ngc", "cnc", "ncc", "fnc", "dnc", "fan", "gc", "ncg", "ncp", "fgc", "txt"};
String SUPPORTED_FILE_TYPES_STRING = "^.*\\.(" + String.join("|", SUPPORTED_FILE_EXTENSIONS) + ")$";

String JUST_STOP_STREAMING = "0";
String STOP_STREAMING_AND_RESET = "1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,13 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == Constants.FILE_PICKER_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null){
Uri uri = data.getData();
if(uri != null){
File gcodeFile = copyPickedFileToCache(uri);
String displayName = getDisplayName(uri);
if(!displayName.toLowerCase().matches(Constants.SUPPORTED_FILE_TYPES_STRING)){
String allowed = "." + String.join(", .", Constants.SUPPORTED_FILE_EXTENSIONS);
EventBus.getDefault().post(new UiToastEvent(getString(R.string.text_unsupported_file_type, allowed), true, true));
return;
}
File gcodeFile = copyPickedFileToCache(uri, displayName);
if(gcodeFile != null){
fileSender.setGcodeFile(gcodeFile);
fileSender.setElapsedTime("00:00:00");
Expand All @@ -262,13 +268,7 @@ private String getDisplayName(Uri uri){
return name != null ? name : "gcode_file";
}

private File copyPickedFileToCache(Uri uri){
String displayName = getDisplayName(uri);
if(!displayName.toLowerCase().matches(Constants.SUPPORTED_FILE_TYPES_STRING)){
EventBus.getDefault().post(new UiToastEvent(GrblUtils.implode(" | ", Constants.SUPPORTED_FILE_TYPES), true, true));
return null;
}

private File copyPickedFileToCache(Uri uri, String displayName){
File destination = new File(requireContext().getCacheDir(), displayName);
try(InputStream in = requireContext().getContentResolver().openInputStream(uri); OutputStream out = new FileOutputStream(destination)){
if(in == null) return null;
Expand Down
24 changes: 10 additions & 14 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="@dimen/card_padding"
android:stretchColumns="0,1,2">
android:stretchColumns="1,2">

<TableRow>

Expand Down Expand Up @@ -90,7 +90,7 @@
android:gravity="center_vertical"
android:paddingTop="@dimen/status_row_padding"
android:paddingBottom="@dimen/status_row_padding"
android:text="X"
android:text="X Axis"
android:textColor="@{machineStatus.enabledPins.x ? @color/colorPrimary : @color/colorTextSecondary}"
tools:ignore="HardcodedText" />

Expand All @@ -105,7 +105,7 @@
android:textAppearance="@style/TextAppearance.Grbl.Coordinate"
android:paddingTop="@dimen/status_row_padding"
android:paddingBottom="@dimen/status_row_padding"
android:textColor="@color/colorTextSecondary"
android:textColor="@color/colorAccent"
android:gravity="end" android:id="@+id/wpos_edit_x" android:tag="X"
android:text='@{String.format("%.3f", machineStatus.workPosition.cordX)}' />

Expand All @@ -118,7 +118,7 @@
android:gravity="center_vertical"
android:paddingTop="@dimen/status_row_padding"
android:paddingBottom="@dimen/status_row_padding"
android:text="Y"
android:text="Y Axis"
android:textColor="@{machineStatus.enabledPins.y ? @color/colorPrimary : @color/colorTextSecondary}"
tools:ignore="HardcodedText" />

Expand All @@ -133,7 +133,7 @@
android:textAppearance="@style/TextAppearance.Grbl.Coordinate"
android:paddingTop="@dimen/status_row_padding"
android:paddingBottom="@dimen/status_row_padding"
android:textColor="@color/colorTextSecondary"
android:textColor="@color/colorAccent"
android:gravity="end" android:id="@+id/wpos_edit_y" android:tag="Y"
android:text='@{String.format("%.3f", machineStatus.workPosition.cordY)}' />

Expand All @@ -146,7 +146,7 @@
android:gravity="center_vertical"
android:paddingTop="@dimen/status_row_padding"
android:paddingBottom="@dimen/status_row_padding"
android:text="Z"
android:text="Z Axis"
android:textColor="@{machineStatus.enabledPins.z ? @color/colorPrimary : @color/colorTextSecondary}"
tools:ignore="HardcodedText" />

Expand All @@ -163,7 +163,7 @@
android:paddingBottom="@dimen/status_row_padding"
android:gravity="end" android:id="@+id/wpos_edit_z" android:tag="Z"
android:text='@{String.format("%.3f", machineStatus.workPosition.cordZ)}'
android:textColor="@{(machineStatus.toolLengthOffset != 0) ? @color/colorPrimary : @color/colorTextSecondary}" />
android:textColor="@{(machineStatus.toolLengthOffset != 0) ? @color/colorPrimary : @color/colorAccent}" />

</TableRow>

Expand All @@ -181,18 +181,14 @@
<TableRow>

<TextView
android:layout_span="2"
android:textAppearance="@style/TextAppearance.Grbl.Footer"
android:text='@{machineStatus.parserState.coordinateSystem + " " + machineStatus.parserState.unitSelection + " " + machineStatus.parserState.distanceMode}' />

<TextView
android:textAppearance="@style/TextAppearance.Grbl.Footer"
android:gravity="center"
android:text='@{"F" + machineStatus.feedRate.toString()}' />
android:text='@{machineStatus.parserState.coordinateSystem + " " + machineStatus.parserState.unitSelection + " " + machineStatus.parserState.distanceMode + " F" + machineStatus.feedRate.toString()}' />

<TextView
android:textAppearance="@style/TextAppearance.Grbl.Footer"
android:gravity="end"
android:text='@{"Rx" + machineStatus.plannerBuffer.toString() + " Tx" + machineStatus.serialRxBuffer.toString()}' />
android:text='@{machineStatus.plannerBuffer.toString() + " | " + machineStatus.serialRxBuffer.toString()}' />
</TableRow>

</TableLayout>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_probing_tab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
android:id="@+id/last_probe_position"
android:fontFamily="monospace"
android:textSize="16sp"
android:textColor="@color/colorAccent"
android:textColor="@color/colorTextPrimary"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Expand Down Expand Up @@ -250,7 +250,7 @@
android:id="@+id/current_tlo"
android:fontFamily="monospace"
android:textSize="16sp"
android:textColor="@color/colorAccent"
android:textColor="@color/colorTextPrimary"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@


<!-- Probing Tab -->
<string name="text_probing_help">1. Do probing with first tool. 2. Change the tool. 3. Probe again with \"Probe + TLO\".</string>
<string name="text_probing_help">Probe: a ferramenta desce até tocar a placa. O zero de Z fica no topo da placa.\nProbe + TLO: depois de trocar a ferramenta, sonde de novo. A diferença de comprimento vira o offset da ferramenta (G43.1).\nTLO ✕: limpa o offset da ferramenta (G49).\n\nPassos\n1. Coloque a placa sob a ferramenta e conecte o fio da sonda.\n2. Defina o avanço, a espessura da placa e a distância de sondagem.\n3. Toque em Probe com a primeira ferramenta.\n4. Troque a ferramenta e toque em Probe + TLO.</string>
<string name="text_probing_feed_rate">Feed rate</string>
<string name="text_touch_plate_thickness">Plate thickness</string>
<string name="text_distance_to_probe">Distance to probe</string>
Expand All @@ -226,7 +226,7 @@
<string name="text_probe_success_auto_zero">Probe success with auto adjust</string>
<string name="text_probe_success">Probe success</string>
<string name="text_probe_success_with_tlo">Probe success. Tool length offset applied</string>
<string name="text_probing_tab_heading">Probing | Tool length offset {fa-info-circle 16dp @color/colorAccent}</string>
<string name="text_probing_tab_heading">Probing {fa-info-circle 16dp @color/colorAccent}</string>
<string name="text_last_probe_position">Last probe position</string>
<string name="text_current_tlo">Current TLO</string>
<string name="probe_plus_tlo">Probe {fa-plus 14dp} TLO</string>
Expand Down Expand Up @@ -283,6 +283,8 @@
<string name="text_time_elapsed">Time elapsed</string>
<string name="text_progress">Progresso</string>
<string name="text_file_not_found">File not found!</string>
<string name="text_select_gcode_file">Selecionar arquivo G-code</string>
<string name="text_unsupported_file_type">Tipo de arquivo não suportado. Permitidos: %1$s</string>
<string name="text_overrides_fsv">Overrides F:S:V</string>
<string name="text_overrides_fs">Overrides F:S</string>
<string name="text_check_mode_on">Check {fa-toggle-on 16dp @color/colorAccent}</string>
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
<string name="text_enable_custom_buttons_desc">добавляет четыре пользовательские кнопки на панель ручного управления.</string>
<string name="text_file_checking_started">Проверка файла начата</string>
<string name="text_file_not_found">Файл не найден!</string>
<string name="text_select_gcode_file">Выберите файл G-code</string>
<string name="text_unsupported_file_type">Неподдерживаемый тип файла. Разрешены: %1$s</string>
<string name="text_file_reading_in_progress">Идёт чтение файла</string>
<string name="text_file_streaming_started">Трансляция файла начата</string>
<string name="text_flood_off">СОЖ {fa-toggle-off 16dp}</string>
Expand Down Expand Up @@ -157,8 +159,8 @@
<string name="text_probe_success_with_tlo">Успех зонда. Длина инструмента смещение применяется</string>
<string name="text_probing_distance">Расстояние зондирования</string>
<string name="text_probing_feed_rate">Скорость подачи</string>
<string name="text_probing_help">1. У зондирования с первым инструментом. 2. Изменение инструмента. 3. Зонд снова с \"зонд + TLO \".</string>
<string name="text_probing_tab_heading">Зондирование | Смещение длины инструмента {fa-info-circle 16dp @color/colorAccent}</string>
<string name="text_probing_help">Probe: инструмент опускается, пока не коснётся пластины. Ноль Z ставится на верх пластины.\nProbe + TLO: после смены инструмента зондируйте снова. Разница длины задаётся как смещение инструмента (G43.1).\nTLO ✕: сбрасывает смещение инструмента (G49).\n\nШаги\n1. Положите пластину под инструмент и подключите провод зонда.\n2. Задайте подачу, толщину пластины и расстояние зондирования.\n3. Нажмите Probe с первым инструментом.\n4. Смените инструмент и нажмите Probe + TLO.</string>
<string name="text_probing_tab_heading">Зондирование {fa-info-circle 16dp @color/colorAccent}</string>
<string name="text_quick_jogging">Кнопки быстрого шагового перемещения</string>
<string name="text_quick_jogging_desc">настройте кнопки быстрого шагового перемещения</string>
<string name="text_reset">Сброс</string>
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@


<!-- Probing Tab -->
<string name="text_probing_help">1. Do probing with first tool. 2. Change the tool. 3. Probe again with \"Probe + TLO\".</string>
<string name="text_probing_help">Probe: the tool moves down until it touches the plate. Z zero is set to the plate top.\nProbe + TLO: after a tool change, probe again. The length difference is applied as the tool offset (G43.1).\nTLO ✕: clears the tool offset (G49).\n\nSteps\n1. Put the touch plate under the tool and connect the probe wire.\n2. Set feed rate, plate thickness and distance to probe.\n3. Tap Probe with the first tool.\n4. Change the tool, then tap Probe + TLO.</string>
<string name="text_probing_feed_rate">Feed rate</string>
<string name="text_touch_plate_thickness">Plate thickness</string>
<string name="text_distance_to_probe">Distance to probe</string>
Expand All @@ -284,7 +284,7 @@
<string name="text_probe_success_auto_zero">Probe success with auto adjust</string>
<string name="text_probe_success">Probe success</string>
<string name="text_probe_success_with_tlo">Probe success. Tool length offset applied</string>
<string name="text_probing_tab_heading">Probing | Tool length offset {fa-info-circle 16dp @color/colorAccent}</string>
<string name="text_probing_tab_heading">Probing {fa-info-circle 16dp @color/colorAccent}</string>
<string name="text_last_probe_position">Last probe position</string>
<string name="text_current_tlo">Current TLO</string>
<string name="probe_plus_tlo">Probe {fa-plus 14dp} TLO</string>
Expand Down Expand Up @@ -341,6 +341,8 @@
<string name="text_time_elapsed">Time elapsed</string>
<string name="text_progress">Progress</string>
<string name="text_file_not_found">File not found!</string>
<string name="text_select_gcode_file">Select G-code file</string>
<string name="text_unsupported_file_type">Unsupported file type. Allowed: %1$s</string>
<string name="text_overrides_fsv">Overrides F:S:V</string>
<string name="text_overrides_fs">Overrides F:S</string>
<string name="text_check_mode_on">Check {fa-toggle-on 16dp @color/colorAccent}</string>
Expand Down
Loading