Skip to content

Commit

Permalink
Fixed a possible plotting issue (#2246)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiaMineJP authored Dec 20, 2023
1 parent 5033e71 commit c03c0b8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/gui/src/components/plot/add/PlotAddForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,27 @@ export default function PlotAddForm(props: Props) {

const defaultsForPlotter = (plotterName: PlotterName) => {
const plotterDefaults = plotters[plotterName]?.defaults ?? defaultPlotter.defaults;
const selectedPlotterName = plotterDefaults.plotterName as PlotterName;
const { plotSize } = plotterDefaults;
const maxRam = plottingInfo[plotterName].find((element) => element.value === plotSize)?.defaultRam;
const maxRam = plottingInfo[selectedPlotterName].find((element) => element.value === plotSize)?.defaultRam;
const defaults = {
...plotterDefaults,
...otherDefaults,
maxRam,
};

if (
(plotterName === PlotterName.BLADEBIT_RAM ||
plotterName === PlotterName.BLADEBIT_DISK ||
plotterName === PlotterName.BLADEBIT_CUDA) &&
+plotters[plotterName].version.split('.')[0] < 3 // Bladebit < 3.0.0 does not support plot compression
selectedPlotterName === PlotterName.BLADEBIT_RAM ||
selectedPlotterName === PlotterName.BLADEBIT_DISK ||
selectedPlotterName === PlotterName.BLADEBIT_CUDA
) {
defaults.bladebitCompressionLevel = undefined;
const plotter = plotters[selectedPlotterName];
// Only Bladebit >= 3.0.0 does support plot compression
if (plotter && plotter.version && +plotter.version.split('.')[0] >= 3) {
defaults.bladebitCompressionLevel = plotterName === PlotterName.BLADEBIT_CUDA ? 1 : 0;
} else {
defaults.bladebitCompressionLevel = undefined;
}
}

return defaults;
Expand Down

0 comments on commit c03c0b8

Please sign in to comment.