  With the Australian Square Kilometre Array Pathfinder (ASKAP) we monitored
the black hole candidate X-ray binary MAXI J1535--571 over seven epochs from 21
September to 2 October 2017. Using ASKAP observations, we studied the HI
absorption spectrum from gas clouds along the line-of-sight and thereby
constrained the distance to the source. The maximum negative radial velocities
measured from the HI absorption spectra for MAXI J1535--571 and an
extragalactic source in the same field of view are $-69\pm4$ km s$^{-1}$ and
$-89\pm4$ km s$^{-1}$, respectively. This rules out the far kinematic distance
($9.3^{+0.5}_{-0.6}$ kpc), giving a most likely distance of $4.1^{+0.6}_{-0.5}$
kpc, with a strong upper limit of the tangent point at $6.7^{+0.1}_{-0.2}$ kpc.
At our preferred distance, the peak unabsorbed luminosity of MAXI J1535--571
was $>78$ per cent of the Eddington luminosity, and shows that the soft-to-hard
spectral state transition occurred at the very low luminosity of 1.2 -- 3.4
$\times$ 10$^{-5}$ times the Eddington luminosity. Finally, this study
highlights the capabilities of new wide-field radio telescopes to probe
Galactic transient outbursts, by allowing us to observe both a target source
and a background comparison source in a single telescope pointing.
